TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #62 · 4 апр.

Когда разрабатываете свой GUI с помощью PyQt для какого-либо софта бывает необходимо позаимствовать цвета из текущего стиля интерфейса. Например, чтобы правильно раскрасить свои виджеты, подогнав их по цвету. Ведь бывает, что ваш GUI используется в разных софтах. Причём некоторые со светлой темой а другие с тёмной. По умолчанию стили наследуются, но если вы задаёте какую-либо раскраску для части виджета через свой styleSheet, то требуется ссылаться на цвета текущего стиля. Как это сделать? Как получить нужный цвет из палитры имеющегося стиля? Это достаточно просто, нужно использовать класс QPalette и его роли. Например, мне нужно достать цвет текста из одного виджета и применить его в другом как цвет фона (не важно зачем именно так, просто захотелось😊). Получаем палитру виджета и сразу достаём нужный цвет, указав его роль. from PySide2.QtGui import QPalette color = main_window.palette().color(QPalette.Text) теперь можем использовать этот цвет в стилях my_widget.setStyleSheet(f'background-color: {color.name()};') Готово, мы динамически переопределили дефолтный стиль используя текущий стиль окна! На самом деле есть запись покороче, в одну строку и без лишних переменных. Не очень-то по правилам CSS, но Qt это понимает. my_widget.setStyleSheet('background-color: palette(Text);') Этот способ не подходит если вам нужно как-то модифицировать цвет перед применением в своих стилях. В этом случае потребуется первый способ. Зато он прекрасно сработает в файле .qss, то есть не придётся в коде прописывать раскраску отдельных элементов через ссылки на палитру, всё красиво сохранится в отдельном файле .qss! QListView#my_widget::item:selected { background: palette(Midlight); } Про имеющиеся роли можно почитать здесь🌍 #qt#tricks

Hashtags

Резултати

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

Пребарај: #defitakeover

当前筛选 #defitakeover清除筛选
TON Crypto News

@toncoin_rap · Post #159 · 21.09.2024 г., 06:39

🎧⤴ 🤑TON Ecosystem on Fire! Major Updates from Fintopio, TBook, and XDAO You Can’t Miss This week, the TON blockchain ecosystemrolled out exciting updates across three projects: Fintopio, TBook, and XDAO. Fintopio, one of the fastest-growing DeFi wallets on Telegram, now has 6 million active monthly users, offering fee-free transfers and NFT storage. TBook introduces free TON WISE Credit Scores, encouraging users to showcase their onchain and offchain activities for potential rewards. Lastly, XDAO is pioneering the first DAO ecosystem on TON, integrating Telegram mini-apps and introducing community-driven farming games to attract new users. TON’s rapid growth continues, with a thriving Web3 community ready to reshape digital finance. Chorus: We on TON, leveling up the game, Fintopio's flexin’, ain’t nothin' the same. TBook’s credit stack, XDAO’s on the rise, Decentralized future, right before your eyes. Verse 1: From Telegram straight to the blockchain scene, Fintopio’s the wallet that’s keepin' it clean. Millions logged in, sending cash for free, DeFi on your phone, simple as can be. $HOLD points stackin’, rewards gettin’ high, Move fast, earn big, touch the sky. Security tight, but the game’s still smooth, Digital assets now got nothin' to lose. Chorus: We on TON, leveling up the game, Fintopio's flexin’, ain’t nothin' the same. TBook’s credit stack, XDAO’s on the rise, Decentralized future, right before your eyes. Verse 2: TBook’s in the mix, building up your score, Onchain data, you got rewards in store. Credit's climbing high, opportunity knocks, Show what you’ve done, you control the stocks. Airdrops comin’ in, WISE Credit the key, Exclusive deals, it’s the place to be. You a star on the rise, now the world’s in view, Link up your past, and the rewards come through. Chorus: We on TON, leveling up the game, Fintopio's flexin’, ain’t nothin' the same. TBook’s credit stack, XDAO’s on the rise, Decentralized future, right before your eyes. Verse 3: XDAO’s movin’ fast, DAOs on the map, Farming those coins while you sit back and tap. Mini apps in play, communities grow, TONxDAO tech, let the future flow. Buildin' syndicates, big moves you choose, DAO-based biz, ain’t no time to snooze. Empowerin’ users, decentralize it all, New age of finance, watch the empires fall. Chorus: We on TON, leveling up the game, Fintopio's flexin’, ain’t nothin' the same. TBook’s credit stack, XDAO’s on the rise, Decentralized future, right before your eyes. Bridge: No more middlemen, we takin' control, In the TON ecosystem, we’re playin' the role. From wallets to scores, and DAOs takin' flight, It’s a Web3 revolution, we shine in the night. #TONBlockchain#DeFiTakeover#Web3Revolution #TONCryptoNewsRapStyle 🎧@toncoin_rap