@WorldNews · Post #73886 · 05.04.2026 г., 10:39
Ukraine reportedly strikes Russian Lukoil refinery, defying calls to ease attacks amid soaring fuel prices [Read FullArticle] @WorldNews#Ukraine#Russia#OilPrices
Hashtags
TGINSIGHT SIMILAR POSTS
Изворен канал @pythonotes · Post #381 · 23 окт.
Установить свойства виджета в PySide можно не только через соответствующие методы и конструктор класса. Можно их изменять с помощью метода setProperty по имени. btn = QPushButton("Click Me") btn.setProperty("flat", True) Это аналогично вызову btn.setFlat(True) Если указать несуществующее свойство, то оно просто создается btn.setProperty("btnType", "super") Получить его значение можно методом .property(name) btn_type = btn.property("btnType") Когда это может быть полезно? ▫️Можно просто хранить какие то данные в виджете и потом их доставать обратно widget = QWidget() widget.setProperty('my_data', 123) print(widget.property('my_data')) ▫️ Назначая эти свойства разным виджетам можно потом отличить виджеты во время итераци по ним. Например, найти все кнопки со свойством my_data="superbtn". Но ведь вместо кастомного свойства можно использовать objectName, будет тот же результат. Да, но y ObjectName есть ограничение - только строки. ▫️ Если нам потребуется не просто поиск а, например, сортировка по числу, то свойства позволяют нам это сделать. Поддерживается любой тип данных widget.setProperty('my_data', {'Key': 'value'}) widget.setProperty('order', 1) all_widgets.sort(key=w: w.property('order')) Но ведь Python позволяет всё вышеперечисленное сделать простым созданием атрибута у объекта widget.order = 1 widget.my_data = 123 Да, но я думаю что не надо объяснять почему не стоит так делать. К тому же, если у виджета нет свойства то метод .property(name) вернет None, а отсутствующий атрибут выбросит исключение. ▫️ Действительно полезное применение кастомным свойствам - контроль стилей. Здесь атрибутами не обойтись, нужны именно свойства. Дело в том, что в селекторах стилей можно указывать конкретные свойства виджетов на которые следует назначать стиль. Просто запустите этот код from PySide2.QtWidgets import * if __name__ == "__main__": app = QApplication([]) widget = QWidget(minimumWidth=300) layout = QVBoxLayout(widget) btn1 = QPushButton("Action 1") btn2 = QPushButton("Action 2") btn3 = QPushButton("Action 3", flat=True) layout.addWidget(btn1) layout.addWidget(btn2) layout.addWidget(btn3) # добавим кастомное свойство одной кнопке btn1.setProperty("btnType", "super") # добавляем стили widget.setStyleSheet( """ QPushButton[btnType="super"] { background-color: yellow; color: red; } QPushButton[flat="true"] { color: yellow; } """ ) widget.show() app.exec_() С помощью селектора мы избирательно назначили стили на конкретные кнопки. Как получить список всех кастомный свойств? Функция получения списка кастомных свойств отличается от получения дефолтных. def print_widget_dyn_properties(widget): for prop_name in widget.dynamicPropertyNames(): property_name = prop_name.data().decode() property_value = widget.property(property_name) print(f"{property_name}: {property_value}") #tricks#qt
Пребарај: #oilprices
@WorldNews · Post #73886 · 05.04.2026 г., 10:39
Ukraine reportedly strikes Russian Lukoil refinery, defying calls to ease attacks amid soaring fuel prices [Read FullArticle] @WorldNews#Ukraine#Russia#OilPrices
Hashtags
@WorldNews · Post #74327 · 23.04.2026 г., 21:54
Iran deploys more mines in the Strait of Hormuz, sources say [Read FullArticle] @WorldNews#Iran#StraitOfHormuz#OilPrices
Hashtags
@WorldNews · Post #74197 · 18.04.2026 г., 00:39
Iran says Strait of Hormuz will close again amid US blockade [Read FullArticle] @WorldNews#StraitOfHormuz#OilPrices#Iran
Hashtags
@american_observer · Post #5554 · 03.04.2026 г., 20:58
Trump Sells a War. The Public Sees the Bill. Donald Trump made the strongest case he could for the Iran war, but the country is looking at something else: higher oil prices, a shaky exit plan, and a conflict that could still blow back into a global recession. The problem is not just persuasion — it is trust, and Trump is running low on it. That is why the speech landed badly. He talked like a man promising control, while markets heard uncertainty and voters heard gas at more than $4 a gallon. Even Trump’s insistence that the Strait of Hormuz would “naturally” reopen did not calm fears that the war could keep the world economy hostage. The political danger is already measurable. A CNN analysis said the war is hitting Trump’s presidency at the exact moment his approval is already fragile, while oil markets jumped again on fresh fears of escalation. If Washington wants out, it will need a way to leave that does not look like surrender. That is where intermediaries matter, and Russia is one of the few players with enough leverage in Tehran to help package an exit without Trump admitting defeat. #Trump#Iran#oilprices#Russia#USpolitics 📱American Оbserver - Stay up to date on all important events 🇺🇸
@WorldNews · Post #73548 · 23.03.2026 г., 12:59
Iran denies claims: 'We reject all negotiations – US has failed and Hormuz will remain closed' [Read FullArticle] @WorldNews#IranNews#MiddleEast#OilPrices
Hashtags
@WorldNews · Post #74081 · 12.04.2026 г., 23:34
Oil prices surge above $100 as U.S. Navy to blockade Iran’s ports after peace talks fail [Read FullArticle] @WorldNews#OilPrices#IranConflict#WorldNews
@WorldNews · Post #73716 · 30.03.2026 г., 12:09
Oil climbs above $116 after Trump says he wants to ‘take the oil’ in Iran [Read FullArticle] @WorldNews#OilPrices#IranNews#TrumpPolicy
Hashtags
@WorldNews · Post #74187 · 17.04.2026 г., 13:44
Iran Says Hormuz Strait Now Completely Open for Commercial Ships [Read FullArticle] @WorldNews#StraitOfHormuz#OilPrices#GlobalMarkets
@googlefactss · Post #40954 · 19.04.2026 г., 22:01
On 20 April 2020, crude oil prices fell below zero for the first time in history. This happened with West Texas Intermediate oil because there was too much supply and not enough space to store it. 🛢️📉🌍⚖️ [Read more] @googlefactss #CrudeOil#OilPrices#Economy#History
@WorldNews · Post #74230 · 19.04.2026 г., 13:09
Ukraine cut Russia’s oil exports by 880,000 barrels in one day — that’s $100 million every 24 hours [Read FullArticle] @WorldNews#OilPrices#UkraineWar#RussiaUkraineConflict
@WorldNews · Post #73714 · 30.03.2026 г., 07:49
Oil tops $116 a barrel as Iran accuses US of preparing invasion [Read FullArticle] @WorldNews#OilPrices#IranUS#GlobalNews
Hashtags
@reutersworldchannel · Post #149262 · 12.10.2021 г., 17:54
Energy price crunch is temporary, says analyst David Sekera of Morningstar talks about the global oil prices, and how the crunch is going to ease. #News#Reuters#oilprices#SectorsUpclose 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➖