@WorldNews · Post #73854 · 04.04.2026 г., 06:54
Trump said Iran was 'decimated.' Then an American F-15E fighter jet was shot down. [Read FullArticle] @WorldNews#IranNews#USIranConflict#WorldNews
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
Пребарај: #usiranconflict
@WorldNews · Post #73854 · 04.04.2026 г., 06:54
Trump said Iran was 'decimated.' Then an American F-15E fighter jet was shot down. [Read FullArticle] @WorldNews#IranNews#USIranConflict#WorldNews
@WorldNews · Post #73693 · 29.03.2026 г., 11:44
Iran ready to face US ground invasion, top lawmaker says | Caliber.Az [Read FullArticle] @WorldNews#IranNews#USIranConflict#WorldNews
@WorldNews · Post #73824 · 03.04.2026 г., 11:19
Trump threatens to destroy Iran bridges and power plants as reports emerge of downed U.S. F-35 [Read FullArticle] @WorldNews#IranNews#TrumpPolicy#USIranConflict
@WorldNews · Post #73593 · 25.03.2026 г., 12:14
Iran rejects Trump's 15-point peace plan: "You negotiate with yourself" — as airstrikes on Tehran and US bases in the Gulf escalate [Read FullArticle] @WorldNews#IranNews#USIranConflict#GulfSecurity
@WorldNews · Post #73738 · 31.03.2026 г., 01:29
Iran's strike wounded over a dozen U.S. personnel and hit valuable jets in Saudi Arabia [Read FullArticle] @WorldNews#IranNews#USIranConflict#SaudiArabiaSecurity
@WorldNews · Post #73538 · 23.03.2026 г., 04:19
5m tonnes of CO2 emitted in just 14 days of US war on Iran, analysis finds [Read FullArticle] @WorldNews#ClimateChange#USIRanConflict#CO2Emissions
@WorldNews · Post #73747 · 31.03.2026 г., 11:34
Poland says ‘no’ to sending Patriot missile launcher to help US fight Iran [Read FullArticle] @WorldNews#PolandNews#PatriotMissile#USIranConflict
@WorldNews · Post #74466 · 30.04.2026 г., 13:19
US set for first-ever use of Hypersonic Weapons in combat against Iran [Read FullArticle] @WorldNews#HypersonicWeapons#USIranConflict#MilitaryTechnology
@CryptoM · Post #65325 · 12.04.2026 г., 23:14
🚀 Expert: Bitcoin's Stability Amid U.S.-Iran Conflict Highlights Its Potential Anthony Pompliano highlighted Bitcoin's role as a beacon of hope during the U.S.-Iran conflict. According to NS3.AI, Pompliano noted that while stocks, bonds, and gold experienced sell-offs, Bitcoin remained stable or even rose slightly. He emphasized that Bitcoin's lower volatility and neutrality could bolster investor demand during times of geopolitical uncertainty. #Bitcoin#Cryptocurrency#Geopolitics#USIranConflict#FinancialStability#InvestorDemand#MarketVolatility#DigitalAssets#BTC
@CryptoM · Post #64559 · 09.04.2026 г., 08:01
🚀 CPI Faces Critical Test Amid Inflation Concerns The upcoming Consumer Price Index (CPI) report is set to be a decisive factor in assessing inflation trends, as consensus builds around a significant rebound in inflation. According to Jin10, the breadth of the energy shock will play a crucial role in determining the intensity of market impacts. The ongoing conflict between the U.S. and Iran has influenced the CPI statistics for March, with energy premiums potentially limiting the Federal Reserve's ability to cut interest rates. There is a risk that inflation expectations may become unanchored, raising questions about whether price pressures are a one-time shock or have spread to other sectors. #CPI#Inflation#EnergyShock#FederalReserve#InterestRates#USIranConflict#MarketImpact#PricePressure
@CryptoM · Post #65326 · 12.04.2026 г., 23:14
🚀 Expert Predicts U.S.-Iran Conflict Impact on Crypto Markets Until 2026 Nic Puckrin has expressed concerns that the ongoing U.S.-Iran conflict could negatively affect cryptocurrency markets until 2026. According to NS3.AI, Puckrin believes that Bitcoin's recovery to $90,000 would require several favorable conditions. He also noted that a Federal Reserve rate cut is unlikely to occur before late Q3 or Q4, and it may not happen at all this year. #USIranConflict#CryptoMarkets#Bitcoin#Cryptocurrency#FederalReserve#MarketPrediction#2026Impact#BitcoinRecovery#BTC
@CryptoM · Post #64459 · 09.04.2026 г., 01:08
🚀 Korean Won Expected to Rebound Amid Lower Oil Prices and Stock Inflows The Korean won is anticipated to recover to levels observed prior to the US-Iran conflict in the second quarter, according to strategists. Bloomberg posted on X, highlighting factors such as declining oil prices and increased foreign investments in stocks as key drivers for this potential rebound. Analysts suggest that these economic conditions could bolster the won's value, reversing the currency's previous downturn. #KoreanWon#OilPrices#StockInflows#USIranConflict#CurrencyRebound#ForeignInvestments#EconomicConditions