Когда разрабатываете свой 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
🗣Top Genres of Podcasts Among Avid Fans
More than 61% of American households have a fan of #podcasts in the music genre.
- 37 million of these households identify as avid fans;
- 24 million consider themselves casual fans.
🚀@PerspectiveIX
❓ Do you listen to podcasts?
#podcasts
Great, engaging and beneficial podcasts
Let's not forget, English podcasts are the kind of content that takes the least time for us to use.
You can make the most of your time by listening to English podcasts and revitalizing parts of the day that may be unused for whatever reason.
How to use podcasts⁉️
English podcast for fast language learning😍😍
🌟If you want to listen to the podcast as efficiently as possible, follow these steps:
🔰Listen to podcasts every day. Listen to podcasts daily and cultivate this habit easily.
Find podcasts that interest you. Ask yourself, "What podcasts should I listen to," and try to choose one that suits your interests.
🔰Listen to podcasts that have transcripts or text. This helps you find new words and phrases quickly in the text and understand the structure of different sentence types.
🔰After listening to the podcast with the text, in the next step try to do it without the text. This will strengthen your listening skills and help you to understand native English speakers more easily, even if they speak very fast.
🔰Do not despair if you listened to an English podcast and could not fully understand it. There are countless ESL podcasts designed for different levels, from beginner to advanced. Surely you can find a podcast that fits your level every day
@TowardDiscoveringEnglish
@TowardDiscoveringEnglish
@TowardDiscoveringEnglish
@TowardDiscoveringEnglish
This is the best foster mom in the world!
🔻Lynx Alyona lives in the Irkutsk Zoo, and she has a very strong maternal instinct.
🔻Over several years, she has already raised orphaned kittens, bear cubs, five puppies, and two Amur tiger cubs.
🔻Alyona makes sure the babies are well-fed, clean, and well-behaved.
🔻As soon as she hears the pitiful meows of abandoned babies, she understands: "Oh, these are mine!"
⏺Here are the🇷🇺(word stress)+🇬🇧texts for you to practice! https://telegra.ph/Podcast-07-04-2
❗️You can also send me the recording of your reading of the Russian text to @RCR_feedback_bot and get feedback!
#podcasts
#brief_and_interesting
😎RCR | Support | Boost
¿Que puede hacer este bot?
@podcastly_bot
Encuentre nuevos podcasts por sistema de búsqueda o recomendación, envíe notificaciones sobre nuevos episodios.
Idiomas: varios incluido español
(Visto en @botsgram_cu)
#podcasts#búsqueda
🎧About 1 in 4 Consumers Say They’ve Made A Purchase After Hearing A Podcast Ad
The US population has embraced podcasts, with the majority of Americans over the age of 12 years listening to them on a weekly basis. And, per a survey by Adobe, more than half (52%) of these #podcast enthusiasts are listening to #podcasts while commuting to work or while they are working.
Among the nearly three-quarters (72%) of respondents who report having heard an ad while listening to a podcast, 1 in 3 say the ads are more engaging than on other formats and 2 in 5 say they are less intrusive. This could be due to the type of ads heard on podcasts, as the majority of ads are still host-read, which aids in maintaining continuity within the podcast.
🦅@PerspectiveIX via MarketingCharts.
🎧The Steady Rise of Podcasts
Over the past decade, #Podcasts have seen a steady rise in popularity. According to Edison Research, 64% of Americans are now familiar with the term “podcasting” and more than 4 in 10 have listened to a podcast themselves.
The format’s rise in popularity clearly coincides with a general increase in digital media consumption, specifically on mobile devices. Also, #Podcast is the only format users can consume passively.
❗️You can start listening to some fantastic podcasts on📻@iXRadio.
🚀@PerspectiveIX via Statista.
❓How familiar are you with podcasting? I...
AI Podcasting Startup Raises $1.3M
Retellio secures $1.30 million in funding to develop AI agents that convert thousands of hours of customer calls into 30-minute podcasts. More details at Retellio's website.
#AI#Funding#Podcasts#Startup#CustomerExperience#Tech
А для всех тех, кто любит неспешно заниматься своими делами в ночной тиши под приятные беседы умных людей, у нас сегодня новый подкаст с канала Pam Grossman — "#156 - Loretta Ledesma, The Death Witch" c ведьмой смерти Лореттой Ледесмой.
Впрочем, разумеется, днём его слушать тоже можно.
Слушать по ссылке.
#podcasts
#witchcraft
#western_esoterism