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

Резултати

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

Пребарај: #currency

当前筛选 #currency清除筛选

#脚本#QuantumultX#Loon#Surge#Shadowrocket#Stash#Crack ✅#Currency-货币查询 👤 脚本作者: @ios151 📌 脚本功能: 解锁会员 💳 特别说明: 一次性解锁 ⬇️ 下载地址: 点我下载 🔗 脚本链接: 点我复制 🔄 脚本转换: 点击传送 ✈️导航💬群组🤖投稿🎁福利

International News

@intnewsagency · Post #8569 · 17.03.2026 г., 15:24

Chinese Yuan Surpasses 12 Rubles for the First Time Since September 2025 Today, the Chinese yuan reached 12.002 rubles, hitting its highest level since September 11, 2025. This marks an increase of 18.2 kopecks from the previous close and 25.79 kopecks above the official rate. The rise reflects yuan’s strengthening amid growing Russia-China cooperation and stabilizing global markets. Experts highlight the yuan’s resilience as crucial for bilateral economic ties. #Russia#China#Yuan#Currency#Finance The main news of Russia and the world ishere.

International News

@intnewsagency · Post #9412 · 29.04.2026 г., 08:42

Russian Government Speeds Up Resumption of Currency and Gold Operations A decree allowing the resumption of currency and gold operations under the budget rule has been signed and will take effect in May instead of July. Dated April 27 and published on the official regulatory portal, this move aims to enhance financial stability and budget flexibility amid current conditions. “Originally planned for July, the situation required acceleration.” #Russia#Finance#Budget#Currency#Gold The main news of Russia and the world ishere.

JenniferMac

@JenniferMac · Post #419 · 30.12.2023 г., 18:47

JUAN O SAVIN talks CURRENCIES, Rv, Nesara, Gold & Silver ⭐️⭐️⭐️⭐️ Show starts today 4.45pm UK/ 11.45am EST/ 8.45am PST 🎬🟨⬜️🤠👍🏼https://youtu.be/G5CLmCNPvtw👆🏼📺🎉 JUAN O SAVIN talks CURRENCIES & 2024 with TOM NUMBERS… Kim Clement, The Rv, Nesara, Gesara, Two Presidents, Tribunals, Aliens, behind the scenes, Roswell, 19.47, Silver, Gold, Nixon, other physics & more.. this is a bumper early NEW YEARS EVE show https://youtu.be/G5CLmCNPvtw👈🏼📺🤠 watch here on YouTube & subscribe to notifications 👆🏼🔔🔔🔢 RETWEET 🔂 #JuanOSavin#Currency#TomNumbers#Gematria#Silver#Gold

💴South African rands are, arguably, among the most beautiful banknotes and coins in the world 🌍✨ South African banknotes feature the iconic “Big Five” animals 🐘🦁🦏: • R10 — rhinoceros • R20 — elephant • R50 — lion • R100 — buffalo • R200 — leopard The reverse side of each note features Nelson Mandela, honoring his legacy as a symbol of democracy, freedom, and national unity in South Africa ✊🏿🇿🇦 #SouthAfrica#Currency#rands#BigFive#NelsonMandela#Heritage#Culture

International News

@intnewsagency · Post #9354 · 23.04.2026 г., 13:29

The ruble declined following the Ministry of Finance’s resumption of currency and gold operations under the budget rule starting in May. As of 15:46 MSK, the Chinese yuan rose to 11.095 rubles, up 1.3% from the previous close and 10.19 kopecks above the official rate. These shifts indicate market caution amid new government financial actions. #Ruble#MinFin#Currency#Yuan#Finance The main news of Russia and the world ishere.

Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40152 · 21.11.2025 г., 15:04

Canada's accessible bank notes feature distinct colors for easy identification: $5 is blue, $10 is purple (and vertical!), $20 is green, $50 is red, and $100 is brown—each with large numbers and tactile dots for the blind and partially sighted. 🇨🇦💵👁️‍🗨 [Source] @googlefactss #Accessibility#BankNotes#Inclusion#Canada#Currency#VisionLoss

DWF Labs Broadcast

@Dwflabs · Post #177 · 26.01.2023 г., 02:15

[19 Jan to 25 Jan] DWF Crypto Snapshot Our latest #crypto report by DWF Labs Managing Partner Andrei Grachev is up. Check out this week's round up 💫 💠 Bitcoin May See Its Largest #Adoption With Brazil And Argentina #Currency Merger 💠 Vitalik Buterin Addresses Potential #Privacy On Ethereum With Stealth Addresses 💠Ethereum Developers Stress-Test #Network In Anticipation Of ETH Withdrawals 💠DWF Labs Unmask The Potential Of Mask Network With US$5 Million Investment 💠Bridge #Protocols Rise To Prominence With Increased #L2 Solutions Activity 💠SUSHI #Community Stands By The Platform And Gives Up Short Term Gains 💠It’s The Battle Of The Ethereum Scaling Solutions 💠Improved Inflation Sentiment Paves The Way For Female #Crypto Adopters 💠Say Hello To The Future Of #Blockchain-Based Crowdfunded Films Full read here. Missed last week's snapshot? Read here. Follow us on Medium here. Stay up-to-date on the latest DWF Labs updates: Website| Twitter | Linkedin | Telegram

#脚本#QuantumultX#Loon#Surge#Shadowrocket#Stash#Crack#Revenuecat#工具#旅游 ✅#旅行迹 ✅#ShellBean-SHH终端 ✅#喵组件 ✅#Currency-汇率换算 👤 脚本作者: @chxm1023 🕒 更新日期: 2024-05-07 📌 脚本功能: 解锁Pro版本 💳 特别说明: 一次性解锁,先开启规则,在进入软件即可!如果无效按[恢复购买]进行恢复! ⬇️ 下载地址: 点击下载 ⬇️ 下载地址: 点击下载 ⬇️ 下载地址: 点击下载 ⬇️ 下载地址: 点击下载 🔗 脚本链接: 长按复制 🔄 脚本转换: 点击传送 ✈️导航💬群组🤖投稿🎁福利

12
ПретходнаСтраница 1 од 2Следна