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

Резултати

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

Пребарај: #map

当前筛选 #map清除筛选
Data Stitches

@data_stitches · Post #155 · 30.10.2021 г., 23:42

简·雅各布斯在天空中 - 研究人员通过 8,400 张卫星图像,找出意大利六个城市中最具活力的街区, 简-雅各布斯在《美国大城市的死与生》中指出街道活力的四个条件: 土地用途的多样性、小块面积、人口集中和经济活动的混合,为了衡量这四个指标研究人员通过卫星数据监测城市屋顶颜色,将城市解构为DNA条纹以及将DNA填充为点阵图来比较六个城市的活力值 #map

Hashtags

Data Stitches

@data_stitches · Post #144 · 17.10.2021 г., 21:42

Cartogram of Pandora Papers - by Nicolas Lambert 将国家面积与潘多拉文件中披露的受益人的数量相对应,投射到球体上,就会画出一个变形扭曲的世界 #map

Hashtags

djangoproject

@djangoproject · Post #89 · 11.07.2016 г., 11:56

https://docs.python.org/3/library/functions.html#map #map(function, iterable, ...) Return an iterator that applies function to every item of iterable, yielding the results. If additional iterable arguments are passed, function must take that many arguments and is applied to the items from all iterables in parallel. With multiple iterables, the iterator stops when the shortest iterable is exhausted. For cases where the function inputs are already arranged into argument tuples, see itertools.starmap().

Hashtags

不求甚解

@Fakeye · Post #3 · 01.11.2019 г., 02:10

#Map#APP 高德地图的实时交通做的不错,感觉可以增加一些细节的体验。比如,如果检测到距离查询的公车站多少距离之后,直接计算出下一班车来的时间需要提前多长时间到车站,或者直接显示现在出发去当前车站赶不赶的上之类的结果。目前步行去车站和车多长时间到站其实是没有任何关联的两个值而已。

Hashtags

Red Nile

@rednile12 · Post #11098 · 28.02.2026 г., 11:58

Fwd from @ 📝IRGC Generals Under a School Desk📝 Despite claims of strikes on nuclear facilities and key figures in Iran, most of the casualties so far are children. At one girls' school, 24 people were killed, with 45sufferingvariousinjuries. There is also fresh footage of strikes on streets: along with military targets in Tehran itself, neighboring houses are being destroyed. Iranian television reports dozens of civilian deaths across the country, and there is little reason to doubt this. During the 12-day war, the total death toll in Iran exceeded one thousand people, with up to 4,870 wounded according to various sources. Iranian authorities then confirmed the deaths of 935 people, including 38 children and 132 women. However, just as the international community swallowed the Gazasector and past heavy casualties in Iran without notice, it will not notice this either. But for those affected in the Gulf states, of which there are (so far?) almost none - they will also try to hold the Tehran authorities accountable. 📍Online maps available by subscription at map.rybar.ru #map#Iran#USA 🧨@rybar_mena — on Middle Eastern chaos with love 💸Support usOriginal msg

Language Trivia 🤔

@languagetrivia · Post #344 · 18.11.2024 г., 09:24

What is the name of this West African country, which has English as its official language despite being surrounded by three countries where French has official or working language status? A) Ghana B) The Gambia C) Liberia D) Sierra Leone Follow 🌍@languagetrivia to learn more about languages and geography #map#guess_the_country

123•••89
ПретходнаСтраница 1 од 9Следна