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

Резултати

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

Пребарај: #halving

当前筛选 #halving清除筛选
SIGNAL

@finsignal · Post #3042 · 20.04.2024 г., 12:56

Bitcoin price range in the 4th cycle of #halving: upper bound ~ $4,500,000 lower bound ~ $140,000 This is if#Bitcoin will eventually follow a growth trajectory in the range of previous cycles.

CryptoTrade1®

@cctrade1 · Post #6016 · 19.04.2024 г., 06:47

What will be the BTC move after#BTC#Halving ?? » 72000 » 75000 » 80000 » 85000 » 100000 Countdown Started!! We will wait for your reply soon » @cctrade19

Hashtags

CryptoTrade1®

@cctrade1 · Post #6004 · 12.04.2024 г., 10:25

What will be the BTC move after#BTC#Halving ?? » 72000 » 75000 » 80000 » 85000 » 100000 Countdown Started!! We will wait for your reply soon » @cctrade19

Hashtags

2016 Halving changed everything — difficulty rose, profits exploded. Reward dropped 25 → 12.5 BTC Everyone said mining was “over”. Instead, BTC went from $400 → $20,000 Mining profitability skyrocketed. This was the moment mining stopped being a hobby— and became an industry. Those who mined pre-halving → became wealthy. Those who mined post-halving → became wealthier. Cycles never fail. @100trillionUSD what’s your 2016 cycle perspective? #Bitcoin#Mining#Halving#BTC

AIn 2012, mining 50 BTC per block was normal. Today that’s $1.85M per block.” Block reward: 50 BTC BTC price: $12 Daily energy cost: almost nothing. Imagine turning $0.15 of electricity into $600 worth of BTC every 10 minutes… And people still called it “magic internet money”. Now? That same 50 BTC = $1,850,000 #Bitcoin#Mining#Crypto#Halving

Venture Village Wall 🦄

@venturevillagewall · Post #3716 · 25.12.2024 г., 22:00

Bitcoin Halving Schedule Announced The next Bitcoin halving event is scheduled, significantly impacting supply dynamics. Current Bitcoin price hovers around $99,000. Stay tuned for more updates on the halving schedule and market reactions. #Bitcoin#Halving#Crypto#BTC#Blockchain#MarketUpdate#SupplyDynamics

Venture Village Wall 🦄

@venturevillagewall · Post #3715 · 25.12.2024 г., 19:00

Bitcoin Miner Invests in AI Tech HIVE, a Canadian bitcoin miner, invests $30 million in AI computations using Nvidia GPUs. HIVE aims for around $15 million annual revenue from this initiative post-bitcoin halving. Meanwhile, many public mining stocks are expected to end the year in loss due to rising operational costs and reduced mining profitability. Full details here: Forklog. #Bitcoin#AI#Mining#HIVE#Investment#Nvidia#Cryptocurrency#Halving#TechInnovation#PublicMining#CryptoMarket

Venture Village Wall 🦄

@venturevillagewall · Post #3754 · 30.12.2024 г., 19:00

Major Developments in Crypto for 2024 2024 marks a pivotal year for the crypto industry featuring key events: 1. SEC approves Bitcoin ETFs - Institutional investments unlocked. 2. $1.2M in BTC sent to Satoshi's wallet - 26.9 BTC transferred. 3. Bitcoin halving - Block rewards cut in half, driving prices. 4. FTX founder sentenced - Sam Bankman-Fried: 25 years imprisonment. 5. AI agents innovate Web3 - Transforming DeFi and smart contracts. 6. Trump wins US elections - Promises regulatory support for crypto. 7. XRP reaches $2.8 - Surge driven by clearer regulations. 8. Bitcoin hits $100K - Institutional buys and halving effects contribute. For more details, read:source #Crypto#Bitcoin#XRP#USDC#USDT#AI#ETF#DeFi#Satoshi#Web3#FTX#Halving#MarketTrends#Trumpl2024#Regulation#Investments#Blockchain#Innovation#Tether#MemeCoins

Venture Village Wall 🦄

@venturevillagewall · Post #3591 · 20.12.2024 г., 12:45

Lost $6.4M, Staying Calm 😙 A crypto investor reported losing $6.4 million in a week but remains unfazed, having been in the market since 2016. They emphasize that such market corrections are normal during bull runs. They bought Bitcoin at $15,900 in November 2022, predicting significant growth for altcoins after the traditional December corrections of halving years. The investor advises others to stay patient and avoid checking their portfolios, expecting altcoin market cap to exceed $1 trillion by April-May 2025. 🔵 View their thoughts here: Tweet🔵 Join the discussion: Crypto Twitter. #Crypto#Bitcoin#Altcoins#MarketCorrection#BullMarket#Halving#Investment#Trading#Portfolio#MarketCap #2025 #BTC#Altseason#BTCto100k#CryptoInvesting#CryptoCommunity#BearMarket#InvestmentStrategy

Venture Village Wall 🦄

@venturevillagewall · Post #4114 · 10.02.2025 г., 13:00

Ethereum: Potential Shift to Trustworthy Money Ethereum could become ‘ultra-secure’ money as supply decreases, claims developer Justin Drake. Post-Dencun, emissions stats: 657,000 BTC vs. 469,000 ETH ($63.4B vs. $1.23B). Bitcoin miners rely on crypto mining; commission share at only 1%. Safety concerns may arise as mining becomes less viable. Halvings could worsen security issues. Read more: ForkLog #Ethereum#Bitcoin#Crypto#Mining#Finance#Deflation#JustinDrake#Dencun#ETH#BTC#Blockchain#Investing#Decentralization#PoS#Halving#Security#MarketTrends#Emissions#DigitalAssets#RiskManagement#Cryptocurrency

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