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

Резултати

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

Пребарај: #ship

当前筛选 #ship清除筛选
404 KIDS SEE GHOSTS (生产力之王版

@Isaiahsystem · Post #1414 · 18.01.2026 г., 13:17

https://x.com/thedankoe/status/2010751592346030461 1.25 亿阅读量...X 最近在推一个百万美元文章活动,将在下一轮收益分成给表现最好的一篇长文发放 100 万美元。一鲸起,万物生成(Generated)。#ship

Hashtags

Interesting Planet 🌍

@interesting_planet_facts · Post #657 · 30.08.2025 г., 16:22

🌎 In 1872, the Mary Celeste was found adrift in the Atlantic Ocean—its crew vanished without a trace, leaving food, cargo, and the ship untouched. This unsolved maritime mystery has puzzled historians ever since. ✨ #disappearance⚡#ship⚡#mystery 👉subscribe Interesting Planet ​

American Оbserver

@american_observer · Post #5664 · 20.04.2026 г., 13:59

The US Has Attacked An Iranian-Flagged Container Ship. A New Stage of the War? ⚠️🌍 The US military has attacked and seized an Iranian-flagged container ship that attempted to get past an American blockade near the strait of Hormuz, the first such interception since the blockade of Iranian ports began last week. 🚢 Iran’s joint military command said Tehran would respond soon and called the US seizure an act of piracy that violated the ceasefire that has been in place since 8 April. The news threw into question Trump’s earlier announcement that US negotiators would head to Pakistan on Monday for another round of talks with Iran. That had raised hopes of extending a fragile ceasefire set to expire by Wednesday, but Iran has not confirmed it will attend. In a post on X, US Central Command said US marines departed the USS Tripoli assault ship by helicopter and rappelled on to Touska on Sunday. The post included a video of the marines onboard the helicopter. Trump had earlier posted on X that the ship had tried to get past the US blockade “and it did not go well for them”. The US president said a US navy guided missile destroyer warned the Touska to stop in the Gulf of Oman but the vessel did not. “[Our] Navy ship stopped them right in their tracks by blowing a hole in the engine room,” Trump said, adding that US marines now had custody of the vessel. 💥 He said the ship was under US treasury sanctions because of “prior history of illegal activity”. The ship is on the treasury department’s list of sanctioned vessels. A spokesperson for Iran military’s central command centre, Khatam al-Anbiya, cited by the Isna news agency, said: “We warn that the armed forces of the Islamic Republic of Iran will soon respond and retaliate against this armed piracy and the US military.” Iranian state media also reported that Tehran had – for now – rejected new peace talks, citing the ongoing blockade, threatening rhetoric, and Washington’s shifting positions and “excessive demands”. Video posted on social media by the US defence department showed the interception of the ship by US forces. “Vacate your engine room,” a US sailor can be heard saying. “We’re prepared to subject you to disabling fire.” The cargo ship was stopped near Iran’s border with Pakistan. Touska had previously left Port Klang, a major port in Malaysia, when the vessel then attempted to move past the US blockade, according to tracking information from TankerTrackers.com. The escalating standoff threatens to deepen the energy crisis roiling the global economy and push the two countries toward renewed fighting, in a conflict that has killed at least 3,000 people in Iran, nearly 2,300 in Lebanon, 23 civilians and 15 soldiers in Israel, and more than a dozen in Gulf Arab states. Thirteen US service members have also been killed. 📉 #us#iranian#container#ship#war 📱American Оbserver - Stay up to date on all important events 🇺🇸

12
ПретходнаСтраница 1 од 2Следна