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

Резултати

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

Пребарај: #nuls

当前筛选 #nuls清除筛选
Pro Analysis

@proanalysistrader · Post #28488 · 21.02.2025 г., 10:07

#NULS/USDT analysis : #NULS is currently in a bearish trend, trading below the 200 EMA and consistently making new lows. The price is testing the 200 EMA, with expectations of a rejection at this level, which will lead to a continuation of the bearish momentum and the formation of new lows. TF : 4h Entry : $0.2760 Target : $0.2150 SL : $0.3145

Hashtags

Pro Analysis

@proanalysistrader · Post #28128 · 06.11.2024 г., 14:20

#NULS/USDT analysis : #NULS is currently in a downtrend, establishing lower lows (LLs) and lower highs (LHs) below the 200 EMA. The price has retraced to the resistance zone, and it is anticipated that it will continue its bearish momentum, potentially testing lower levels. TF : 4h Entry : $0.2996 Target : $0.2667 SL : $0.3230

Hashtags

Pro Analysis

@proanalysistrader · Post #27776 · 30.07.2024 г., 11:34

#NULS/USDT analysis - #NULS is trading in a downtrend below the 200 EMA. The price is currently declining from resistance zone and is expected to test the support zone soon. TF : 1H Entry : $0.3080 Target : $0.2840 SL : $0.3246

Hashtags

Pro Analysis

@proanalysistrader · Post #27755 · 13.07.2024 г., 17:36

#NULS/USDT analysis - #NULS is in an uptrend, trading above the 200 EMA. After the breakdown of the previous swing high, the price is now sustaining this level and is expected to continue its bullish momentum to test new highs. TF : 30min Entry : $0.3237 Target : $0.3479 SL : $0.3171

Hashtags

Binance Big Pump Signals Future trade

@binancebigpumpsignalsfuture · Post #2025 · 09.02.2022 г., 05:44

#NULS result 2 nd target achieved in just 2 days ✅✅ One more huge quick profit 32%🤑💰🤑 👉 Still thinking? The more you wait more you lose profit ☎️ Contact @MichaelStrategiesVip for membership and grab next breakout signal

Hashtags

Binance Big Pump Signals Future trade

@binancebigpumpsignalsfuture · Post #2017 · 06.02.2022 г., 15:52

#NULS result 1 st target achieved in just 6 house ✅✅✅ One more huge quick profit 6.3%🤑💰🤑 👉 Still thinking? The more you wait more you lose profit ☎️ Contact @MichaelStrategiesVip for membership and grab next breakout signal

Hashtags

Binance Big Pump Signals Future trade

@binancebigpumpsignalsfuture · Post #1876 · 30.12.2021 г., 09:21

#NULS result 1rd target achieved in just 16 house ✅✅✅ One more huge quick profit 5%🤑💰🤑 👉 Still thinking? The more you wait more you lose profit ☎️ Contact @MichaelStrategiesVip for premium membership and grab next breakout signal

Hashtags

🗺 Travel the World | Private Expeditions

@expeditionsworldwide · Post #64 · 18.08.2020 г., 22:16

📉 Today the market is in a slight correction. This is good for me. Any price drop, I regard as an opportunity to buy cryptocurrency at a good price. Today I add to my portfolio - NULS (#NULS). Bought it for $ 10, on the largest crypto-exchange Binance. 🎯 Long term investment. The Motive to buy: #NULS is ranked 168 in the CoinMarketCap rating. The coin was not pumped! The price has retested the support zone of $0.2125-0.3798 and moves to the resistance zone of $1.1065-1.3249. To continue the growth, it is necessary to consolidate above $1.3250. Price projector points to growth towards $2.15. 🚀 Expected to grow from 85% to 460%. 😱 You can see my previous investment result here - https://bit.ly/30GlvN2

Hashtags

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