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

Пребарај: #exchanges

当前筛选 #exchanges清除筛选
以太坊区块链新闻| ETH 以太币圈热瓜

@ethereumglobalnews · Post #1372 · 17.11.2025 г., 05:58

🪙242.9K ETH withdrawn from CEXs this week#OnChain#Exchanges Coinglass 數據顯示,過去 7 天共有約 24.29 萬枚 ETH 從中心化交易所流出,其中 Binance、Bitfinex、Coinbase Pro 均錄得顯著減少,顯示部分持幣者正從交易所轉往自託管或鏈上配置。 #Ethereum#DeFi#Markets#Crypto ⚡ 交易所庫存下降通常意味短線拋壓減弱,但後續能否轉為有效需求仍需觀察鏈上活躍度。 👍@Web3NewsInsight 🥲 🥲Follow for more Web3 News 🤣

DWF Labs Broadcast

@Dwflabs · Post #17 · 24.08.2022 г., 12:59

Since the beginning of the financial markets, traders and investors have mostly paid attention to the price of their assets and hoped to see “green numbers”. Indeed, the pricing of a stock or a cryptocurrency is one of the most important metrics of any investment. But what if only a couple of people were trading such an asset providing neither volume nor liquidity? Find out more about DWF Labs Market Making, OTC Liquidation and Venture Capital for #Web3#crypto projects. #cryptocurrency#venturecapital#markets#projects#investment#trading#exchanges#blockchain https://www.linkedin.com/pulse/how-avoid-dangers-crypto-death-spiral-dwf-labs/

Crypto M - Crypto News

@CryptoM · Post #65250 · 12.04.2026 г., 10:15

🚀 North Korean Crypto Theft Funds Military Expenditures, Experts Warn Security experts have highlighted that cryptocurrency theft is increasingly being used to finance North Korea's military activities. According to NS3.AI, researchers have observed a months-long infiltration targeting Drift Protocol, indicating a shift in North Korean operations. These activities have expanded beyond phishing to include attacks on exchanges, wallet services, and key permission holders of DeFi protocols. #NorthKorea#CryptoTheft#MilitaryExpenditures#SecurityExperts#NS3AI#DriftProtocol#Phishing#Exchanges#WalletServices#DeFiProtocols

Venture Village Wall 🦄

@venturevillagewall · Post #3596 · 20.12.2024 г., 14:18

EU Tightens Crypto Regulations 🔵 EU crypto exchanges must delist $USDT by December 30 due to the Markets in Cryptoassets regulation. This ban aims to restrict cash usage but may push users towards DEX and other stablecoins. Centralized exchanges are in a race to comply by the deadline. More details in the regulation here. Join the discussion on CryptoTwitter🦢 #EU#Regulation#Crypto#USDT#Exchanges#MarketsInCryptoassets#DEX#Stablecoins#Cash#Compliance#Ban#Deadline#Investment#Blockchain#Technology#DigitalAssets#Finance#MarketTrends

Venture Village Wall 🦄

@venturevillagewall · Post #3926 · 20.01.2025 г., 04:00

Melania Meme Token Debuts on Major Exchanges Centralized exchanges like MEXC, BingX, Gate, and Bitget list Melania Meme (MELANIA) token. The token's economic model: 35% team share (30-day lock), 20% treasury, 20% community, 15% public offering, 10% liquidity. Major transaction: an address bought 3.8M MELANIA for 800k USDC, now with a profit of $38.6M. Read more: Wu Blockchain News #Crypto#MemeToken#MELANIA#TrumpProject#Dogecoin#Bitcoin#Profit#Exchanges#Trading#Finance#USDC#MarketAnalysis#Tokenomics#Investment#TradingStrategy#Speculation#ProfitableAddresses#MarketTrends#Blockchain#Web3#VC

Venture Village Wall 🦄

@venturevillagewall · Post #4242 · 25.02.2025 г., 16:00

OKX Settles Dispute with US DOJ 🕊OKX settles dispute with the US Department of Justice, admitting fault for operating without a license. The exchange will pay $84 million in fines and forfeit $421 million in commissions from US clients. This settlement marks a pivotal point for OKX, allowing continued collaboration with regulators to enhance solutions for clients and the crypto market. Details:OKX Announcement 🟠 In related news, $635 million in leveraged Bitcoin positions were liquidated within 24 hours. #Crypto#Bitcoin#OKX#Regulations#Compliance #OKX#Crypto#Bitcoin#Finance#Regulations#Compliance#Investment#Blockchain#US#Litigation#Trading#Market#Fines#Exchanges#Leveraged#Settlement#Lawsuits#Justice#USDOJ#CryptoMarket