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

Резултати

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

Пребарај: #predictions

当前筛选 #predictions清除筛选
EdgeMarket.AI 📣

@edgemarketai · Post #8087 · 02.04.2026 г., 16:45

🔥 BIG MATCH ALERT 🔥 Who takes it this time? 🏴󠁧󠁢󠁥󠁮󠁧󠁿 Manchester City 🏴󠁧󠁢󠁥󠁮󠁧󠁿 Chelsea FC Two giants. One winner. ⚡ Connect your BSC chain wallet to get started 🎁 Get 100 $BET just for connecting your wallet 🔄 Points convert to $BET before ICO Make your prediction now 👇 https://edgemarket.ai/bnb/football/who-will-win/statistics/69ce5bf05e16d74b01b818be Don’t just watch play the outcome. #Football#Predictions#MatchDay

EdgeMarket.AI 📣

@edgemarketai · Post #8084 · 29.03.2026 г., 12:17

🏀 WHO WINS? Los Angeles Lakers vs Golden State Warriors April 2026 🔥 This isn’t just a game… This is where AI meets prediction markets. ⚡ Make your call ⚡ Back your conviction ⚡ Earn with intelligence 👇 Drop your answer below YES = Lakers NO = Warriors Or earn ICO points here 👇 https://edgemarket.ai/bnb/baseball/who-wins-lakers-vs-warriors-in-april-2026/statistics/69c393aabf328939c875b80d #EdgeMarket#NBA#Predictions#AI#Crypto

EdgeMarket.AI 📣

@edgemarketai · Post #8088 · 02.04.2026 г., 16:55

🎾 GRAND SLAM PREDICTION 🎾 Will Iga Świątek make it to the Wimbledon Final in July 2026? The stakes are rising. The pressure is real. Can she dominate on grass? ⚡ Connect your BSC chain wallet to get started 🎁 Get 100 $SIGNAL just for connecting your wallet 🔄 Points convert to $SIGNAL before ICO Make your prediction now 👇 https://edgemarket.ai/bnb/tennis/will-iga-witek-reach-the-wimbledon-final-in-july-2026/statistics/69ce7e065e16d74b01b8260f Don’t just watch predict the outcome.and collect $BET #Tennis#Wimbledon#Predictions#EdgeMarket

EdgeMarket.AI 📣

@edgemarketai · Post #8113 · 19.04.2026 г., 07:48

Will Manchester United qualify for the Champions League this season? 🔴 Big games. Tight margins. Pressure moments. Make your prediction now on EdgeMarket 👇 https://edgemarket.ai/bnb/football/will-manchester-united-qualify-for-the-champions-league-this-season/statistics/69e0c10fdcd75d8e4622fcfb #ManchesterUnited#ChampionsLeague#EdgeMarket#Predictions#Football

EdgeMarket.AI 📣

@edgemarketai · Post #7983 · 08.02.2026 г., 12:08

🎡Coachella 2026 — record-breaking year or not? Will attendance smash records? Will every date sell out? 📊 The market is live on EdgeMarket — powered by community signals and open participation. 👉 Jump in now: https://edgemarket.ai/bnb/social-gists/Coachella%202026%20break%20attendance%20records/statistics/6985b4f6ff612403d86c373f #Coachella2026#EdgeMarket#Predictions#Web3#EventMarkets#CryptoCommunity

EdgeMarket.AI 📣

@edgemarketai · Post #8151 · 01.05.2026 г., 14:34

🚨 LIVE MARKET: Yankees vs Red Sox 🚨 Who takes it? You do not watch. You participate. Tap in. Predict. Win. https://edgemarket.ai/bnb/baseball/new-york-yankees-vs-boston-red-sox/statistics/69f1a59da9870bbf09e694f0 #EdgeMarket#MLB#Yankees#RedSox#Crypto#Predictions#Web3#EarnOnline

Venture Village Wall 🦄

@venturevillagewall · Post #3738 · 28.12.2024 г., 16:00

Bitcoin to Hit $150,000 Next Year 🔭 Galaxy Research predicts Bitcoin will cross $150,000 in H1 2024 and could reach $185,000 by Q4 2025. Analysts note Bitcoin has consistently outperformed other asset classes, expecting its market cap to reach 20% of gold's value. 🔗 Read more: Leviathan News 📉 Total market cap of AI tokens has dropped by 28% recently, now at $50.93 billion. #Bitcoin#AI#Crypto#Galaxy#MarketTrends #Bitcoin#AI#Crypto#Galaxy#MarketTrends#DeFi#Investing#Trends#Predictions #2024 #2025 #Gold#InstitutionalInvestors#TechNews#AIModels#Innovation#MarketCap#S&P500 #Cryptocurrency#Blockchain

Venture Village Wall 🦄

@venturevillagewall · Post #3744 · 29.12.2024 г., 13:00

Five Predictions for On-Chain 2025 Key predictions for 2025 include: 1️⃣ DEX/CEX monthly volume ratio to surpass 20% 2️⃣ One AI agent token projected to hit $10 billion 3️⃣ Emergence of 3-5 new vertical launch tracks based on Pump Fun 4️⃣ At least 5 base tokens expected to be listed on Binance Spot 5️⃣ Hyperliquid to generate over $1 billion in spot opportunities. For details, read more here from Wu Blockchain News. #AI#Crypto#VC#DEX#CEX#Binance#Altcoins#Investments#Token#SpotMarket#VolumeRatio#Blockchain#Predictions#EmergingTrends#Startups#Hyperliquid#PumpFun#MarketOpportunities

Desi Memes Funny Jokes

@DESI_MEMES_Funny_Jokes · Post #5775 · 05.11.2024 г., 18:15

💥 Join 1xBet at SIGMA Europe 2024! ◾ Join Official Channel : T.me/OfficialOffers1xBET 📅 From November 11 to 14, we are waiting for you at the Mediterranean Maritime Hub in Valletta, Malta. Come to booth №2154 - our team will share important insights about the iGaming industry prospects and present new opportunities for earning with the 1xBet affiliate program! 😏🍸 Delicious cocktails and entertainment are on us! We have also prepared valuable prizes for you: 🍏 Apple flagship gadgets ⚽️ FC Barcelona T-shirts 👟 Exclusive Nike Air Force sneakers 🎮 Nintendo gaming consoles 🏟 VIP tickets for the PSG v Barcelona match 💰 The summit will bring together the gambling, betting, and affiliate marketing monsters. Become part of this important event. Write to your personal manager now to arrange a meeting with the 1xBet team. 🤝 See you at SIGMA Europe 2024! 💵Get £1600 + 150 Free Spins as Welcome Bonus with promo code WORLDCUPAU 🔖1xBet Only Global Pro Promo WORLDCUPAU 🌏 United by WORLDCUPAU, United by 1xBet! Register💻 | 1xBet App📱 🔘 Be a part of 1XBET,Want to be remote Manager,Affiliate Partner,Ads or Agent Cash/Wallet then feel free message to the Manager of 1XBET directly from Telegram. 📬 Support : @Manager_1xBet #Worldcupau#1xbet#1xbetbangladesh#EPL#englishpremierleague#EPL2024#football#footballseason#1XSPORTS#predictions#sports#sportsbook#footballfans