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

Резултати

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

Пребарај: #outflows

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

@ethereumglobalnews · Post #1379 · 18.11.2025 г., 06:58

🤣📊#ETH ETFs see heavy #outflows. 📉 以太坊ETF 昨日合計流出 87,460 ETH約 $2.79 億美,連續呈現資金壓力。 🏦 BlackRock(iShares ETHA)單日流出 54,730 ETH,持有 3,773,989 ETH,仍為最大單一持倉者。 ——— #以太坊#虚拟货币#ETF#区块链#市场动向 ⚡️ 資金明顯轉向避險,ETH 結構短線偏弱,需觀察週內是否止血 👍@Web3NewsInsight 🥲 🥲Follow for more Web3 News 🤣

Venture Village Wall 🦄

@venturevillagewall · Post #4215 · 22.02.2025 г., 07:00

Bitcoin and Ethereum ETF Outflows Report On February 21, Bitcoin spot ETFs saw a net outflow of $62.77M, while BlackRock's ETF IBIT experienced a net inflow of $21.64M. Additionally, Ethereum spot ETFs recorded a net outflow of $8.92M. Read more here. #Bitcoin#Ethereum#ETF#Crypto#Investment#Finance#BlackRock#MarketTrends#Outflows#Inflows#FinanceNews#Blockchain#WuBlockchain#DigitalAssets#SpotETF#Cryptocurrency#Trading#MarketAnalysis#Funds#Assets

Venture Village Wall 🦄

@venturevillagewall · Post #4247 · 26.02.2025 г., 04:00

Bitcoin ETFs Face Nearly $1B Outflows Bitcoin ETFs experience record outflows nearing $1 billion. In 2023, all crypto sectors underperform compared to Bitcoin, with AI frameworks down 84%, agent projects 70%, and more. SEC acknowledges NYSE Arca's filing for Grayscale Ethereum ETF staking. Meanwhile, Bybit hackers have laundered 45,900 ETH ($113M) in 24 hours, totaling 135,000 ETH ($335M) to date, with more expected to be laundered soon. #Bitcoin#ETH#Crypto#NFT#SEC#Grayscale#Bybit#Hacking#Market#AI#AgentProjects#Memecoins#Gamefi#DelphiDigital#VC#Outflows#BlockChain#Finance#Investments#DeFi#Web3

Venture Village Wall 🦄

@venturevillagewall · Post #4229 · 24.02.2025 г., 10:00

Crypto Outflows Reach $508M Amid Caution Digital asset investment products experienced significant outflows of $508 million as investors react cautiously to uncertainties following the US Presidential inauguration. Influencing factors include market volatility surrounding trade tariffs, inflation, and monetary policy adjustments. Read more: Unfolded #Crypto#Investment#USPolitics#MarketVolatility#Inflation#MonetaryPolicy#DigitalAssets#DeFi#Ethereum#Trading#Finance#Economics#Outflows#Blockchain#Investors#Caution#RiskManagement#CryptoNews#MarketTrends#AssetManagement

Venture Village Wall 🦄

@venturevillagewall · Post #4250 · 26.02.2025 г., 13:00

Crypto Market Faces Severe Downturn 1️⃣ BTC inflow to exchanges hits annual high amidst panic. Price dropped below $90,000, triggering massive sell-offs. 2️⃣ Fear & Greed Index plunges to extreme fear (25), signaling anxiety in crypto markets. 3️⃣ BTC holders recorded losses of $1.73 billion, marking the highest since August 2024. 4️⃣ ETF funds faced major outflows totaling $1.01 billion, a record since launch. 5️⃣ Meme coins like Dogecoin and Shiba Inu drop significantly, as market saturation affects their traction. 6️⃣ New AI-meme project MIND of Pepe raises $6.8 million, distinguishing itself with functional AI integration. 7️⃣ Ethereum Foundation pledges $1.25 million for legal defense of Tornado Cash developer. 📈More Details on Bitcoin Rally Potential 🔗Ethena Stablecoin Investment 🔗Optifye Startup Controversy #Crypto#BTC#ETH#MemeCoins#AI#MarketTrends#Investments#Outflows#FearAndGreed#Blockchain#Saturation#MarketAnalysis#DeFi#Ethereum#TornadoCash#VC#WhaleAlert#YCombinator#Optifye#MINDofPepe