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

TGINSIGHT SIMILAR POSTS

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

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

Установить свойства виджета в PySide можно не только через соответствующие методы и конструктор класса. Можно их изменять с помощью метода setProperty по имени. btn = QPushButton("Click Me") btn.setProperty("flat", True) Это аналогично вызову btn.setFlat(True) Если указать несуществующее свойство, то оно просто создается btn.setProperty("btnType", "super") Получить его значение можно методом .property(name) btn_type = btn.property("btnType") Когда это может быть полезно? ▫️Можно просто хранить какие то данные в виджете и потом их доставать обратно widget = QWidget() widget.setProperty('my_data', 123) print(widget.property('my_data')) ▫️ Назначая эти свойства разным виджетам можно потом отличить виджеты во время итераци по ним. Например, найти все кнопки со свойством my_data="superbtn". Но ведь вместо кастомного свойства можно использовать objectName, будет тот же результат. Да, но y ObjectName есть ограничение - только строки. ▫️ Если нам потребуется не просто поиск а, например, сортировка по числу, то свойства позволяют нам это сделать. Поддерживается любой тип данных widget.setProperty('my_data', {'Key': 'value'}) widget.setProperty('order', 1) all_widgets.sort(key=w: w.property('order')) Но ведь Python позволяет всё вышеперечисленное сделать простым созданием атрибута у объекта widget.order = 1 widget.my_data = 123 Да, но я думаю что не надо объяснять почему не стоит так делать. К тому же, если у виджета нет свойства то метод .property(name) вернет None, а отсутствующий атрибут выбросит исключение. ▫️ Действительно полезное применение кастомным свойствам - контроль стилей. Здесь атрибутами не обойтись, нужны именно свойства. Дело в том, что в селекторах стилей можно указывать конкретные свойства виджетов на которые следует назначать стиль. Просто запустите этот код from PySide2.QtWidgets import * if __name__ == "__main__": app = QApplication([]) widget = QWidget(minimumWidth=300) layout = QVBoxLayout(widget) btn1 = QPushButton("Action 1") btn2 = QPushButton("Action 2") btn3 = QPushButton("Action 3", flat=True) layout.addWidget(btn1) layout.addWidget(btn2) layout.addWidget(btn3) # добавим кастомное свойство одной кнопке btn1.setProperty("btnType", "super") # добавляем стили widget.setStyleSheet( """ QPushButton[btnType="super"] { background-color: yellow; color: red; } QPushButton[flat="true"] { color: yellow; } """ ) widget.show() app.exec_() С помощью селектора мы избирательно назначили стили на конкретные кнопки. Как получить список всех кастомный свойств? Функция получения списка кастомных свойств отличается от получения дефолтных. def print_widget_dyn_properties(widget): for prop_name in widget.dynamicPropertyNames(): property_name = prop_name.data().decode() property_value = widget.property(property_name) print(f"{property_name}: {property_value}") #tricks#qt

Hashtags

Резултати

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

Пребарај: #verb

当前筛选 #verb清除筛选
English Speakers

@English_Speakers · Post #57 · 12.01.2017 г., 12:13

⤴️#Word_of_the_Day⤴️ 📚nibble Audio Pronunciation /ˈnɪbəl/ #verb 1⃣ : to eat slowly or with small bites [+ object] ✅We nibbled cheese and crackers. [no object] ✅We nibbled on some cheese and crackers before dinner. — often + at ✅She felt a fish nibble at the end of her fishing line. ✅Insects nibbled at the tree's leaves. — sometimes used figuratively ✅He nibbled at the idea of changing careers [=he thought briefly about changing careers], but decided against it in the end. 2⃣ [+ object] : to bite (something) very gently ✅He nibbled her ear. ✅nibble (away) at [phrasal verb] ✅nibble (away) at (something) : to make (something) disappear or go away very slowly ✅Police have been nibbling (away) at crime in the city for years. [=police have been very slowly reducing the amount of crime in the city] @English_Speakers

Learn RCRussian🤍💙❤️

@learnRCRussian · Post #5753 · 29.11.2025 г., 09:00

Если я погладил много котиков, значит ли это, что я гладиатор? If I've petted many kitties, does that make me a gladiator? • Гладить (imperf.) [gla-dit'] = • Погладить (perf.) [pa-gla-dit'] Meanings: 1) to iron clothes 2) to pet, to stroke (an animal) Also: • Гладиатор (masc.noun) [gla-di-a-tor] А gladiator (a warrior) Not everyone who ГЛАДИт cats can become a ГЛАДИатор. Or can they? 😒⚔️ #tricky_words #verb #meme #learn_russian 😎RCR | Support | Boost

VERB Raises $558M to Acquire TON VERB (ticker VERB) is securing approximately $558 million in funding to build a public TON treasury. With these funds, the company plans to buy Toncoin ($TON) and hold it as its primary reserve asset. The goal is to become the first public company whose core “cushion” consists of TON — effectively treating TON as a reserve asset on its balance sheet. VERB expects to earn both from TON’s price appreciation and staking rewards. Once the deal closes (scheduled for August 7, 2025), VERB will rebrand as TON Strategy Co. (TSC) and continue growing its existing projects. Investors: Over 110 institutional and “crypto-native” participants, including Pantera, Animoca, Kraken, BitGo, Vy Capital, Ribbit Capital, and Graticule (GAMA). Advisors & Partners: Experts from Kingsway Capital, TON Foundation, and Blockchain.com will join governance. Having Pantera, Animoca, Kraken, and BitGo on board is meant to add both expertise and trust. Leadership Team: Executive Chairman: Manuel Stotz (Kingsway Capital; President, TON Foundation) CEO: Veronika Kapustina (former TON Foundation advisor; ex-Morgan Stanley) CFO: Sara Olsen (Europa Partners; former Onyx by JPMorgan) Special Advisor: Peter Smith (CEO & Co-Founder, Blockchain.com) VERB is betting that TON will remain the main blockchain for Telegram’s product ecosystem. As Telegram’s ecosystem grows, so could the value of VERB’s TON reserves. Post-Closing Metrics: ➡️Lock-up:~36% of equity for 6–12 months ➡️Cash Ratio:~77% cash among DAT companies holding non-BTC/ETH assets — one of the highest in the sector ➡️TON Treasury Size: ~5% of TON’s circulating market cap ➡️Capacity for Further TON Accumulation ➡️Ticker: VERB remains listed on Nasdaq, with the new treasury strategy effective post-close ➡️Advisors: Cohen & Company (placement), Reed Smith, Perkins Coie, Brownstein Hyatt Farber Schreck, Morgan Lewis Risks: This is a private placement (PIPE) with standard risks: the transaction may not close, markets could decline, and the strategy might underperform. VERB discloses these risks in its disclaimer. Read press release 📱RedotPay | 🔃StormTrade | ❤️CapsGame |📱Degenphone #TON#Telegram#PIPE#Verb#Investments#Treasury