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

Резултати

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

Пребарај: #skillgaming

当前筛选 #skillgaming清除筛选
TONlines – News

@tonlines · Post #6981 · 30.04.2025 г., 11:55

⚡️TapSwap Community: Major News Incoming Tomorrow! #TapSwapBeta#SkillGaming#Web3Games TapSwap Community announces a major update about their private beta launching tomorrow, featuring three exclusive skill-based games in Telegram. Limited spots are available, and interested participants should prepare to apply using a Google form link with their Telegram handle. Source: link @tonlines

TONlines – News

@tonlines · Post #6772 · 15.04.2025 г., 09:28

TapSwap Community: Elevate Your Gaming Skills with Precision #SkillGaming#TapToWin#ClassicWithCrypto The TapSwap Community emphasizes skill and precision in classic games like Tetris, Solitaire, and Bubble Shooter. Players are encouraged to hone their focus and ability to outplay and earn, adding purpose to their gaming experience. Source: link @tonlines

Nigeria Football Hub

@football_nigeria · Post #1098 · 19.05.2025 г., 14:01

🎮TapSwap officially launched the beta! The project has made an important step forward — now skill games are available for the first testers directly in Telegram. Convenient format, fast loading and no unnecessary actions. What's included in the beta: • 🎯 Three games where the outcome depends on your skills • 💰 Integration with $TAPS • 📲 Access via Telegram mini-app ⚠️ At the current stage, only selected users have access to the beta. If you are among them, you can already try out the platform before the official release. 🗓The public launch is scheduled for early June. #TapSwap#БетаЗапуск#SkillGaming#Web3UA Bot link:tapswap_bot📱 Nigeria Football Hub

INSIDER USA | News

@insider_usa_news · Post #3352 · 19.05.2025 г., 13:04

🎮TapSwap officially launched the beta! The project has made an important step forward — now skill games are available for the first testers directly in Telegram. Convenient format, fast loading and no unnecessary actions. What's included in the beta: • 🎯 Three games where the outcome depends on your skills • 💰 Integration with $TAPS • 📲 Access via Telegram mini-app ⚠️ At the current stage, only selected users have access to the beta. If you are among them, you can already try out the platform before the official release. 🗓The public launch is scheduled for early June. #TapSwap#БетаЗапуск#SkillGaming#Web3UA Bot link:tapswap_bot📱 INSIDER USA 👉🏻 Subscribe