TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #380 · 21 окт.

Регулярно приходится писать и ревьюить код, где используется PySide2-6. Заметил, что в подавляющем большинстве случаев настройка создаваемых базовых виджетов происходит через методы. Думаю, всем знаком такой способ. Простой пример с кнопкой: button = QPushButton("Click Me") button.setMinimumWidth(300) button.setFlat(True) button.setStyleSheet("font-size: 20pt") button.setToolTip("Super Button") button.clicked.connect(lambda: print("Button clicked")) Но есть и альтернативный способ - настройка через свойства. Это просто ключевые аргументы конструктора класса. Хоть они и не указаны в документации как аргументы, но они есть) Этот код делает тоже самое но с помощью Property button = QPushButton( "Click Me", minimumWidth=300, flat=True, styleSheet="font-size: 20pt", toolTip="Super Button", clicked=lambda: print("Button clicked"), ) Где это может быть полезно ▫️ Это выглядит более аккуратно и коротко, уже повод использовать ▫️ Может использоваться в заполнении лейаута, когда нам не нужно никакое другое взаимодействие с виджетом и поэтому сохранять его в переменную не требуется. Например, лейбл или кнопка. widget = QWidget(minimumWidth=400) layout = QHBoxLayout(widget) layout.addWidget(QLabel("Button >", alignment=Qt.AlignRight)) layout.addWidget(QPushButton("Click Me", clicked=lambda: print("Button clicked"))) widget.show() Либо так widget = QWidget(minimumWidth=400) layout = QHBoxLayout(widget) for wd in ( QLabel("Button >", alignment=Qt.AlignRight), QPushButton("Click Me", clicked=lambda: ...) ): layout.addWidget(wd) widget.show() ▫️ Можно хранить настройки в каком-то конфиге или генерировать на лету, после чего передавать как kwargs. kwargs = {"text": "Hello " * 30, "wordWrap": True} my_label = QLabel(**kwargs) Как получить полный список доступных свойств? Эта функция распечатает в терминал все свойства виджета и их текущие значения def print_widget_properties(widget): meta_object = widget.metaObject() for i in range(meta_object.propertyCount()): property_ = meta_object.property(i) property_name = property_.name() property_value = property_.read(widget) print(f"{property_name}: {property_value}") #tricks#qt

Hashtags

Резултати

Пронајдени 4 слични објави

Пребарај: #exoticaz

当前筛选 #exoticaz清除筛选
PT风向旗

@Ptfxq · Post #856 · 14.02.2025 г., 08:38

#AvistaZ#CinemaZ#ExoticaZ#AnimeZ#开放注册 https://avistaz.to/auth/register https://cinemaz.to/auth/register https://exoticaz.to/register https://animetorrents.me/register.php 注:不支持 VPN 注册 Happy Valentine’s Day! 💔 If you're stuck at home without a date, you're not alone—we're opening registrations for all of us in the same boat. Join in and let’s make the most of it! 🎉 Registration open on AvistaZ, CinemaZ, ExoticaZ & AnimeZ

PT资讯频道

@PrivateTrackerNews · Post #607 · 10.06.2019 г., 09:07

2019/06/10 #开放注册 #OpenSignupTracker #国外PT 整理自电报@PT资讯频道 @privatetrackernews 亚洲电影电视综合站 AvistaZ联盟,开放注册一周 Tracker's Name: #AvistaZ Genre:General Sign-up Link: https://avistaz.to/auth/register Closing date: Registration open till 16th June 2019 Additional information: AvistaZ (AsiaTorrents) is an Asian Private Torrent Tracker for Asian Movies / TV / General Releases. Note: Password must be 8+ characters with at least one number and uppercase letter. AvistaZ is the sister-site of PrivateHD, AnimeTorrents, Cinemaz and ExoticaZ. 动漫站 AvistaZ联盟,开放注册一周 Tracker's Name: #AnimeTorrents Genre: Anime Sign-up Link: https://animetorrents.me/register.php Closing date: Registration open till 16th June 2019 Additional information:AnimeTorrents (also known as AnT) is a private tracker for Anime releases. It has a huge collection of Anime and is pretty easy to use and manage. It has a newbie rule " Newbies are automatically promoted to member status when they have been newbies for 5 or more days and have achieved a ratio of 1.0 or higher with at least a 2GB upload. " AnimeTorrents is the sister-site of PrivateHD, Avistaz, Cinemaz and ExoticaZ. 亚洲XXX AvistaZ联盟 Tracker's Name: #Exoticaz Genre: XXX Sign-up Link: https://exoticaz.to/register Additional information: Exoticaz is a Private Torrent Tracker for Asian XXX Releases. ExoticaZ is the sister-site of PrivateHD, Avistaz, Cinemaz and AnimeTorrents. 亚洲电影电视 开放注册一周 Tracker's Name: #AsianCinema Genre: General Sign-up Link: https://asiancinema.me/register/ Closing date: Open signup for 7 days Additional information: AsianCinema is a new Private Torrent Tracker for Asian Movies / TV Releases in untouched format. 印度电影电视综合站 Tracker's Name: #TellyTorrent Genre: General Sign-up Link: https://tellytorrent.net/register/null Additional information: TellyTorrent is a Private Torrent Tracker for Indian Movies / TV / General Releases. 高清电影电视综合站 Tracker's Name: #DXDHD Genre: General Sign-up Link: https://dxdhd.com/register/null Closing date: Soon! Additional information: DXDHD is a Private Torrent Tracker for HD/UHD Movies / TV / General Releases. 综合站 Tracker's Name: #IceTorrent Genre: General Sign-up Link: https://www.icetorrent.org/signupfree.php Additional information: Ice Torrent is a Private Torrent Tracker for General Releases. 综合站 Tracker's Name: #Nostalgic Genre: General Sign-up Link: https://nostalgic.to/users/register Additional information: Nostalgic is a Private Torrent Tracker for nostalgic media tv/games/movies/audio/tape rips/anime/woc content/console/roms, plenty more categories and a lot of it.