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

Резултати

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

Пребарај: #gtc

当前筛选 #gtc清除筛选
Coin Sonar

@CoinSonar · Post #244021 · 18.04.2026 г., 07:04

#GTC | Volume spike (USDT PAIR) 130 times the average volume 142.91K USDT traded in 15 min └Selling vol: 77.96K USDT 🔴 Boost score: 1/10 24h Vol: 104.82K USDT (Binance) Price: 0.100 (+1.2% in 24h)

Hashtags

Coin Sonar

@CoinSonar · Post #243969 · 18.04.2026 г., 04:49

#GTC | Volume spike (USDT PAIR) 296 times the average volume 107.93K USDT traded in 5 min └Buying vol: 61.28K USDT 🟢 Boost score: 4/10 24h Vol: 104.82K USDT (Binance) Price: 0.101 (+1.2% in 24h)

Hashtags

Coin Sonar

@CoinSonar · Post #243612 · 17.04.2026 г., 11:25

#GTC | Volume spike (USDT PAIR) 118 times the average volume 129.07K USDT traded in 15 min └Buying vol: 74.15K USDT 🟢 Boost score: 4/10 24h Vol: 104.82K USDT (Binance) Price: 0.099 (+1.2% in 24h)

Hashtags

Pro Analysis

@proanalysistrader · Post #28458 · 08.02.2025 г., 15:30

#GTC/USDT analysis : #GTC is currently retracing towards the 200 EMA, creating a potential long opportunity on lower time frames (LTF). The price has bounced back from the support zone and is anticipated to test higher levels. TF : 2h Entry : $0.418 Target : $0.469 SL : $0.385

Hashtags

Pro Analysis

@proanalysistrader · Post #28399 · 18.01.2025 г., 18:25

#GTC/USDT analysis : #GTC is currently in a downtrend, marked by a series of lower lows (LLs) and lower highs (LHs). The price is trading within a resistance zone, encountering significant resistance. Consequently, a continuation of the decline is anticipated from this level, with the price likely to test lower levels in the near future. TF : 4H Entry : $0.658 Target : $0.560 SL : $0.722

Hashtags

Pro Analysis

@proanalysistrader · Post #28075 · 27.10.2024 г., 12:23

#GTC/USDT analysis : #GTC has broken below support levels. The price is expected to continue falling and test lower levels, as the higher time frame (HTF) is bearish. Wait for the price to retest the zone before entering a short position. TF : 4h Entry : $0.644 Target : $0.596 SL : $0.678

Hashtags

Mexc Crypto Signals Pumps Trading Kucoin

@mexc_signals_pumps_trading · Post #1029 · 09.05.2024 г., 21:20

#GTC/USDT UPDATE: #GTC is now trading around 1.27$. #GTC has broken out a Inverse Head and shoulder pattern on hourly time frame. So the Possible scenario is According to the pattern, we can see short term bullish momentum in it and we can see the price pump 15-20%. Stay tuned with us for further updates✔️

Hashtags

Alex Kowalski | Trade

@kowalskitrade · Post #648 · 22.08.2024 г., 18:08

#GTC The coin looks very good, there is buying, there is reaction from the zones, waiting for further markup of the asset to cover the upper weekly imbalance 📈Sign up on Bybit to trade with me

Hashtags

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