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

Резултати

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

Пребарај: #adoptable

当前筛选 #adoptable清除筛选
Sabertoof's Arts!

@artbysabertoofs · Post #604 · 07.04.2026 г., 10:18

First of the few adopts I'll be doing this week! A handsome, colorful werewolf! 👀🐺 He'll be up for sale soon for $65! ❤️ #adoptable

Hashtags

Sabertoof's Arts!

@artbysabertoofs · Post #567 · 05.03.2026 г., 22:01

BIG YEEN COMIN THRU! 😤 I've got this handsome fella for sale! He's sporting a hyper t-dick (trans bits)! 👀 Something a little indulgent. 🤭 Asking price is $75! He can come with a SFW alt as well as the t-dick version seen here. ^^ DM or reply to claim! #adoptable

Hashtags

Sabertoof's Arts!

@artbysabertoofs · Post #558 · 01.03.2026 г., 19:08

Lil horse adopt ready for a new home! ❤️ Kind of a Valentine's okapi mood here... 🥹 I hope he looks nice! Asking $40 for him! You'll get character rights, high-res/small-res files, and a NSFW (sheath) alt if you desire! Base provided by @/Twistedhound - please check them out! DM or reply to claim if you're interested! #adoptable

Hashtags

Sabertoof's Arts!

@artbysabertoofs · Post #400 · 18.10.2025 г., 01:09

Offering this fella up for $75! ^^ I went for a "blood moon" themed wolf this time around! 🔴🐺 Feel free to DM to claim if you would like him. He comes with high-res and small res files and character rights upon purchase. Payment through PayPal invoices! #adoptable#werewolf#sheath Can't purchase but want to help? I have a post you can share if you'd like. ^^ Thank you all so much! https://bsky.app/profile/sabertoofs.bsky.social/post/3m3glvbc2fc2r

Sabertoof's Arts!

@artbysabertoofs · Post #399 · 16.10.2025 г., 18:48

Offering this fella up for $80! ^^ He's a spooky werewolf ready to romp around on Halloween! :D Feel free to DM to claim if you would like him. He comes with high-res and small res files and character rights upon purchase. Payment through PayPal invoices! #adoptable#werewolf#sheath Can't purchase but want to help? I have a post you can share if you'd like. ^^ Thank you all so much! https://bsky.app/profile/sabertoofs.bsky.social/post/3m36lkpy52s2y