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

Пребарај: #standardchartered

当前筛选 #standardchartered清除筛选
Venture Village Wall 🦄

@venturevillagewall · Post #4281 · 01.03.2025 г., 22:00

Bitcoin Predicted to Reach $200K Soon Standard Chartered's Geoff Kendrick forecasts Bitcoin will hit $200K this year and could reach $500K before Trump exits the presidency. Predictions reflect growing confidence in BTC's potential growth trajectory. #Bitcoin#Crypto#Finance#Investment#Prediction#Market#Trump#StandardChartered#DigitalAssets#GeoffKendrick

Venture Village Wall 🦄

@venturevillagewall · Post #4172 · 17.02.2025 г., 10:00

Joint Venture for HKD-Backed Stablecoin Standard Chartered, Animoca Brands, and HKT have established a joint venture to issue a HKD-backed stablecoin under Hong Kong’s new regulatory framework. This collaboration will leverage Standard Chartered Bank (Hong Kong)'s robust infrastructure and governance. More details can be found here: Animoca Brands. #Stablecoin#HongKong#Finance#Crypto#VC#StandardChartered#AnimocaBrands#HKT#Regulation

Crypto M - Crypto News

@CryptoM · Post #64926 · 10.04.2026 г., 10:15

🚀 Stablecoin Joint Venture Model Dominated by Banking Sector A joint venture in the stablecoin sector is primarily led by the banking industry. According to PANews, Standard Chartered Bank (Hong Kong) holds a 50.5% stake, making it the majority shareholder. Animoca Brands owns 37.5%, while Hong Kong Telecom indirectly holds 12% through Quality Champion Limited. This structure reflects a model where the banking sector leads, with support from technology and telecommunications. #Stablecoin#JointVenture#BankingSector#StandardChartered#AnimocaBrands#HongKongTelecom#Telecommunications#Technology#Banking#Blockchain

Venture Village Wall 🦄

@venturevillagewall · Post #3835 · 10.01.2025 г., 04:00

Russia to Sell Seized Bitcoin Assets The Russian Ministry of Finance plans to sell seized Bitcoin assets from the Infraud hacking case, starting with a batch valued at approximately $10 million. Marat Tambiev, a corrupt official, previously obtained 1,032.1 BTC from the hacker group. Read more here. #Bitcoin#Russia#Infraud#Crypto#DigitalAssets#Banking#Finance#Regulation#MiCA#Custody#StandardChartered#EU#Hacking#Seizure#MaratTambiev#CryptoNews#BTC#Blockchain#FinanceNews#News

Venture Village Wall 🦄

@venturevillagewall · Post #3974 · 24.01.2025 г., 19:00

Big Moves in Crypto Regulation News 🚀 US Senator Cynthia Lummis, a vocal Bitcoin advocate, elected Chair of the Senate Digital Assets Committee. Proposed strategic Bitcoin reserve hints at potential significant moves for Bitcoin. Meanwhile, Trump's recent crypto executive order suggests a reserve of 'seized digital assets,' increasing speculation around Bitcoin's future. 🔗 For further details, read the article here. 🔗 In additional news, the SEC has opened the door for Wall Street banks to hold crypto. 🔗 Standard Chartered forecasts Bitcoin could reach $200,000 by the end of 2025. 🔗 Japan's Central Bank raised interest rates to a 17-year high, now at 0.5%, causing ripples across markets, including crypto. #Crypto#Bitcoin#US#Regulations#SEC#InterestRates#Japan#Senate#DigitalAssets#Investment#FinancialMarkets#WallStreet#Speculation#CynthiaLummis#CryptoBanks#PanteraCapital#StandardChartered#Ethereum#AI#VC

Venture Village Wall 🦄

@venturevillagewall · Post #4074 · 05.02.2025 г., 16:00

Crypto Market Faces Uncertainty, Analysts Warn Analysts predict further decline in the crypto market amid U.S. political uncertainty. Lack of progress on Bitcoin reserves and disappointing updates from David Sachs contribute to investor hesitance, say SkyBridge Capital's Anthony Scaramucci and QCP Capital experts. Yet, Standard Chartered forecasts Bitcoin may hit $500,000 during Trump's presidency. El Salvador recently added 11 BTC to its national Bitcoin reserve, totaling 6068 BTC. Medical firm Semler Scientific bought 871 BTC, raising its total to 3192 BTC. Additionally, Canadian company Neptune Digital Assets acquired 20 BTC, boosting their balance to 376 BTC. Meanwhile, MicroStrategy has paused further Bitcoin purchases after 12 consecutive weeks. For more details, visit: Forklog #Crypto#Bitcoin#TrumpsPresidency#SkyBridge#ElSalvador#SemlerScientific#NeptuneDigitalAssets#MicroStrategy#Investment#MarketAnalysis#QCPCapital#StandardChartered#BTC#CryptoMarket#PoliticalUncertainty#Blockchain#Investors#Reserve#Finance