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 слични објави

Пребарај: #skilltoearn

当前筛选 #skilltoearn清除筛选
Crypto Drop Club

@drop_cryptogo · Post #1809 · 19.05.2025 г., 12:05

🎮TapSwaphas reached a new level - beta is already online! Now skill games are available to the first users directly in Telegram. No downloads - everything is fast, convenient and already with $TAPS integration . What's in beta: • 🎮 3 play-to-skill games — it’s not clicks that matter, but real skill • 💸 Using and testing $TAPS in action • 🧩 Convenient Telegram mini-app — launch in a couple of seconds ⚠️Beta is available only to a limited number of users. If you've gained access, you're among the first to test the mechanics before the mass launch and possibly earn an advantage. 📅 Public release - already in early June. Get ready:TapSwapis a game changer. #TapSwap#CryptoGaming#SkillToEarn#Web3UA Bot link:tapswap_bot📱 Crypto Drop Club 👉 SUBSCRIBE

Crypto Drop Club

@drop_cryptogo · Post #1799 · 15.05.2025 г., 17:34

😱 Are you missing everything again? This is the last chance to get into the TapSwap beta test before it goes mainstream! We've almost assembled a select group of people - those who will be the first to see how TapSwap works from the inside. Want to go there? Then go for it! In beta: 🎯 Games where it's important not to poke, but to think 🪙 $TAPS is not a toy, but a currency 📲 Everything via Telegram — no downloads, no headaches Leave your nickname and we will find you (in a good way): 👉https://forms.gle/Wdp8ZsofBM6Xzjyk6 Bot link: tapswap_bot📱 #TapSwap#Бета#SkillToEarn#TONGaming Crypto Drop Club 👉 SUBSCRIBE

Nigeria Football Hub

@football_nigeria · Post #1083 · 15.05.2025 г., 14:19

⚠️ Final call to join the TapSwap beta! We are finalizing the formation of the early access group. If you haven't sent your Telegram nickname yet, now is the time to do it.📱 As part of the beta version you will receive: - Access to skill-based mechanics — Possibility to test $TAPS in operation — Participation directly through Telegram, without unnecessary installations 📩 Leave your nickname here so we can add you to the list: 👉https://forms.gle/Wdp8ZsofBM6Xzjyk6 Bot link: tapswap_bot📱 #TapSwap#Бета#SkillToEarn#TONGaming Nigeria Football Hub

INSIDER USA | News

@insider_usa_news · Post #3338 · 15.05.2025 г., 16:01

⚠️Last chance to get into the TapSwap beta test We are finalizing the formation of the early access group. If you haven't sent your Telegram nickname yet, now is the time to do it.📱 As part of the beta version you will receive: - Access to skill-based mechanics — Possibility to test $TAPS in operation — Participation directly through Telegram, without unnecessary installations 📩 Leave your nickname here so we can add you to the list: 👉https://forms.gle/Wdp8ZsofBM6Xzjyk6 Bot link: tapswap_bot📱 #TapSwap#Бета#SkillToEarn#TONGaming INSIDER USA 👉🏻 Subscribe