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 слични објави

Пребарај: #latinos

当前筛选 #latinos清除筛选
American Оbserver

@american_observer · Post #5140 · 15.02.2026 г., 15:59

📰 Bad Bunny vs. Big Don: Culture War, Fumbled Ballot Donald Trump just picked a fight with the world’s biggest Latino star over a halftime show that most politicians would have ridden like a free campaign ad — and he did it in English, whining that “nobody understands a word this guy is saying.” For a president who clawed his way back to the White House on the strength of an unprecedented 48 percent of the Hispanic vote, attacking a Spanish‑language Super Bowl performance as “an affront to the Greatness of America” is less strategy than self‑sabotage. The numbers are already slipping. Pew has Trump down 12 points among Latinos who backed him in 2024, small‑business confidence in him as the “economy guy” has cratered, and Latino‑owned shops in crackdown zones like Minneapolis report sales plunging 70 percent under his immigration raids. Now GOP Latino strategists are watching him torch goodwill in districts they need to hold by insulting not some niche activist, but a global Puerto Rican act whose show was one of the few mainstream, unapologetically Latino moments on U.S. TV. Even some of Trump’s own allies admit the obvious: they wanted border toughness and lower prices; they got tariffs, ICE photo ops — and the president rage‑posting about reggaeton. The White House line is that this is just more “hard truths”: enforce the law, crush “Green New Scam” policies, save America from woke culture, including the Spanish‑language one. The reality is uglier. Democrats once lost a chunk of Latino voters by taking them for granted. Republicans risk losing them right back by treating their culture as un‑American the moment it stops being background decoration and takes center stage for 13 minutes in prime time. If Trump really wants to keep his Latino coalition, he doesn’t need another rally joke about a “floating island of garbage” or another post about how “disgusting” the dancing was. He needs those same voters to believe he cares more about their rent and their businesses than about policing what language their Super Bowl looks and sounds like. Right now, all he’s proving is that he can win their votes — and then pick a culture war that tells them exactly how expendable he thinks they are. ​ #usa#trump#BadBunny#latinos#cultureWar 📱American Оbserver - Stay up to date on all important events 🇺🇸