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

Резултати

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

Пребарај: #decentralizedfinance

当前筛选 #decentralizedfinance清除筛选
Crypto M - Crypto News

@CryptoM · Post #64468 · 09.04.2026 г., 01:43

🚀 Solstice Finance Expands DeFi Asset Management with eUSX Growth Solstice Finance is advancing decentralized finance (DeFi) asset management beyond single-strategy vaults, according to Tiger Research. The platform's eUSX has reached approximately $360 million in total value locked (TVL). According to NS3.AI, Solstice is currently operating eUSX and is preparing to launch strcUSX and oUSX. However, the platform still encounters challenges related to on-chain profit verification, funding-fee volatility, and team execution risk. #DeFi#SolsticeFinance#AssetManagement#eUSX#TVL#Blockchain#Crypto#DecentralizedFinance#FinanceInnovation

Crypto M - Crypto News

@CryptoM · Post #64760 · 09.04.2026 г., 19:58

🚀 DeFi Security Concerns Raised After Drift Hack Ann Irvina Ravinther, former marketing head at Drift Labs, expressed concerns over the security of decentralized finance (DeFi) following a recent hack that resulted in a personal loss of $76,000. According to NS3.AI, Ravinther highlighted that such security vulnerabilities pose significant challenges for mainstream adoption by traditional financial markets. #DeFi#SecurityConcerns#DriftHack#AnnIrvinaRavinther#NS3AI#DecentralizedFinance#MainstreamAdoption#TraditionalFinancialMarkets

Crypto M - Crypto News

@CryptoM · Post #64776 · 09.04.2026 г., 22:11

🚀 CFTC and DOJ Legal Actions Could Influence Future of Prediction Markets The Commodity Futures Trading Commission (CFTC) and the Department of Justice (DOJ) have initiated legal proceedings against the states of Arizona, Connecticut, and Illinois concerning their actions against CFTC-registered prediction markets. According to NS3.AI, a recent 2-1 ruling by the Third Circuit Court upheld an injunction preventing New Jersey from applying its gambling laws to Kalshi, a prediction market platform. The court determined that Kalshi's contracts related to sports events are classified as swaps under the Commodity Exchange Act, thereby falling under the exclusive jurisdiction of the CFTC. This legal dispute has the potential to significantly influence the regulatory framework for decentralized prediction markets and crypto-native derivatives across the United States. #CFTC#DOJ#PredictionMarkets#Kalshi#CommodityExchangeAct#Regulation#CryptoDerivatives#USLaw#LegalActions#DecentralizedFinance

Crypto M - Crypto News

@CryptoM · Post #64928 · 10.04.2026 г., 10:22

🚀 Aave Faces Internal Challenges Amid Governance Disputes PANews posted on X (formerly Twitter). Aave, a prominent player in the decentralized finance (DeFi) sector, is currently facing significant internal challenges that are proving more daunting than the ongoing bear market. The departure of three key service providers—BGD Labs, ACI, and Chaos Labs—marks a critical juncture for the platform. These exits highlight a clash between the founder's vision and decentralized governance. Aave Labs, which holds 23% of the token voting power, is pushing for a transition to V4. However, the service providers have found themselves without a voice in the decision-making process, while also facing increasing legal risks. This situation has led them to withdraw their support, effectively voting with their feet. The troubles facing Aave underscore the fact that risks in the DeFi space are not solely market-driven. Sometimes, the most significant threats come from within the organization itself. #Aave#DeFi#GovernanceDisputes#DecentralizedFinance#InternalChallenges#TokenVoting#V4Transition#LegalRisks#ServiceProviders#AaveLabs#AAVE

Venture Village Wall 🦄

@venturevillagewall · Post #4124 · 11.02.2025 г., 16:00

Major ETH Transfer and Lido V3 Launch 🚨 29,250 #ETH (~$77.8M) transferred from #Binance to an unknown wallet, according to Whale Alert. In other news, Lido has launched V3 with customizable ‘stVaults,’ enhancing Ethereum staking flexibility. More details can be found here. 🔍 Analysts from Merkle Science report that in 2024, investors lost over $500M due to fraud linked to meme tokens, primarily through social engineering attacks on platforms like X and YouTube. 📈#HongKong now recognizes $BTC and $ETH for investment visa applications, positioning itself as a competitive hub for crypto investors. 💰 DeFi platform Legend has secured $15M from Andreessen Horowitz and Coinbase Ventures. Stay informed! 🔗Lido V3 Announcement ## Keywords: #ETH#Lido#Binance#Crypto#MemeToken#HongKong#BTC#VC#DeFi#Legend#InvestmentVisa#WhaleAlert#Fraud#SocialEngineering#Ethereum#Investment#CryptoNews#Blockchain#Finance#CryptoInvestors#DecentralizedFinance #ETH#Lido#Binance#Crypto#MemeToken#HongKong#BTC#VC#DeFi#Legend#InvestmentVisa#WhaleAlert#Fraud#SocialEngineering#Ethereum#Investment#CryptoNews#Blockchain#Finance#CryptoInvestors#DecentralizedFinance

Venture Village Wall 🦄

@venturevillagewall · Post #3782 · 03.01.2025 г., 16:00

Lost Dogs Listing Date Announced 📅 The anticipated listing for Lost Dogs is set for January 14, 2025. Key details: - Total token supply: 18 billion - No vesting: All tokens unlocked immediately - Market cap: $100 million; Token price: $0.0055 🗓️ Claim for BUILD scheduled for January 7, potentially introducing PX farming via WOOF + BUILD in EARN. For more updates, join the DOGS community! #Crypto#LostDogs#VC#Blockchain#Farming#TokenListing #Crypto#VC#TokenListing#LostDogs#Blockchain#Farming#BUILD#Claim#CryptoNews#MarketCap#Investment#DecentralizedFinance#DeFi#Tokens#PYX#EARN#WOOF

Crypto M - Crypto News

@CryptoM · Post #64885 · 10.04.2026 г., 06:54

🚀 Tria Integrates Aptos Network for Enhanced Global Transactions Tria, a non-custodial financial operating system, has announced the integration of its global trading engine with the Aptos network. According to ChainCatcher, this integration allows over 500,000 users across more than 150 countries to directly access and trade Aptos assets. Users can now perform cross-chain exchanges and asset interactions within a single application without the need for cross-chain bridges. The collaboration aims to leverage Aptos's sub-second confirmation and parallel execution technology to provide users with a seamless transaction experience. Additionally, it seeks to further connect traditional finance, Web2, and on-chain infrastructure. #Tria#AptosNetwork#GlobalTransactions#NonCustodial#FinancialOperatingSystem#CrossChainExchanges#AssetInteractions#Blockchain#Web2#OnChainInfrastructure#Aptos#Crypto#DecentralizedFinance#Fintech#APT