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

Резултати

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

Пребарај: #jamesbond

当前筛选 #jamesbond清除筛选
Reuters: World

@reutersworldchannel · Post #149201 · 11.10.2021 г., 06:00

'No Time to Die' debuts below expectations 'No Time to Die,' the latest installment in the James Bond franchise, debuted to $56 million at the North American box office. #News#Reuters#JamesBond#Film Subscribe: http://smarturl.it/reuterssubscribe Reuters brings you the latest business, finance and breaking news video from around the globe. Our reputation for accuracy and impartiality is unparalleled. Get the latest news on: http://reuters.com/ Follow Reuters on Facebook: https://www.facebook.com/Reuters Follow Reuters on Twitter: https://twitter.com/Reuters Follow Reuters on Instagram: https://www.instagram.com/reuters/?hl=en ➖@reutersworldchannel➖

Reuters: World

@reutersworldchannel · Post #149142 · 08.10.2021 г., 22:02

No time for the battery to die: Bond's Aston Martin goes electric Aston Martin - an epitome of British motoring style - is going through a modern twist with the DB5 and DB6 models now being retrofitted to reappear in limited numbers as electric cars. #AstonMartin#JamesBond#News#Reuters#EV#NoTimeToDie Subscribe: http://smarturl.it/reuterssubscribe Reuters brings you the latest business, finance and breaking news video from around the globe. Our reputation for accuracy and impartiality is unparalleled. Get the latest news on: http://reuters.com/ Follow Reuters on Facebook: https://www.facebook.com/Reuters Follow Reuters on Twitter: https://twitter.com/Reuters Follow Reuters on Instagram: https://www.instagram.com/reuters/?hl=en ➖@reutersworldchannel➖

Auto Life

@revheadcrypto · Post #581 · 15.10.2024 г., 13:41

🚗✨ Celebrating 60 Years of Bond with Aston Martin! 🎉 Introducing the stunning Aston Martin DB12 Goldfinger Edition, painted in a striking silver reminiscent of the iconic DB5 from "Goldfinger." 🕶️💎 The Q badge on the bumper adds a touch of intrigue! Inside, luxury reigns with 18-carat gold accents on the central console, and the cherry on top? An embroidered eight of spades on the driver’s sun visor. ♠️✨ Under the hood, it’s all power with a 4.0L twin-turbo V8 engine delivering 680 hp and 800 Nm of torque. 🔥💪 Only 60 exclusive vehicles will be produced, each accompanied by a piece of film history: a 35mm reel from "Goldfinger." 🎬🎞️ #AstonMartin#DB12#GoldfingerEdition#JamesBond#LuxuryCars#60YearsOfBond#Auto

Auto Life

@revheadcrypto · Post #610 · 28.10.2024 г., 06:23

✨ Introducing the Rolls-Royce Phantom Goldfinger! 🚗💨 In celebration of the 60th anniversary of "Goldfinger," this stunning long-wheelbase sedan is a tribute to the iconic film. 🎥💛 Featuring a color scheme reminiscent of the Phantom III Sedanca de Ville driven by the notorious Auric Goldfinger, this masterpiece is truly one-of-a-kind! 🌟 The iconic "Spirit of Ecstasy" is adorned with real gold, and there's even a hidden compartment holding a gold bar shaped like the Phantom! 🪙✨ Get ready to experience luxury like never before! #RollsRoyce#PhantomGoldfinger#JamesBond#LuxuryCars#Goldfinger#AutomotiveArt#Elegance#Auto

Auto Life

@revheadcrypto · Post #418 · 01.09.2024 г., 10:09

🚗✨For Sale: Aston Martin Vanquish!✨🚗 This stunning grand tourer isn't just any car; it was featured in a promotional photoshoot for the James Bond film "Die Another Day" starring Pierce Brosnan! 🌟 🔹Power: 460 HP 🔹Mileage: Over 60,000 km 🔹Price: Up to $100,000 Don't miss your chance to own a piece of cinematic history! 🎬💎 #AstonMartin#Vanquish#JamesBond#DieAnotherDay#LuxuryCars#CarForSale#BondCar#DreamCar#Auto

Мирослава Карпович

@m1r0slavakarpovich · Post #1606 · 23.09.2024 г., 19:00

-Жду Вас вечером.В семь. -А повод? -А повод банален…Обнять…(локации для объятий прилагаются) 😂 24 сентября Алматы 26 сентября Тольятти 27 сентября Ульяновск 28 сентября Москва 29 сентября Краснодар 30 сентября Ростов-на-Дону Жду Вас❤️‍🔥 Девушку Бонда создавали : Папарацци @kamenskaya_art🖤 ШикБлескЛоск @visagiste_olesya💋 #reddress#autumn#september#theatre #2024 #women#femme#photooftheday#photography#friday#moscow#moodoftheday#jamesbond#bondsbaby#lady#mira#fashion#extravaganza#muah#heavenonearth#purelove#astana#actress#model#фото#фотодня#фотосессия#havefun#chique#photobomb