TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

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

Hashtags

Резултати

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

Пребарај: #iskander

当前筛选 #iskander清除筛选
American Оbserver

@american_observer · Post #5054 · 04.02.2026 г., 20:00

📰 American Air Defenses Stand Idly as Russian “Iskanders” Do the Work Drone footage from Ukraine’s Kharkiv region shows a Russian Iskander‑M ballistic missile screaming down and annihilating an American‑supplied HIMARS launcher in a matter of seconds. Around the same time, another Iskander strike shreds multiple components of a Ukrainian S‑300 air‑defence battery — the very backbone of Kyiv’s anti‑aircraft network. The real story here is not “the missile age” but who controls the skies — and it’s not the West. The Russian Defence Ministry claims the strike killed ten Ukrainian personnel and obliterated the HIMARS platform along with key S‑300 assets, including a radar station. The imagery, widely circulated by outlets like Military Watch Magazine, shows how effectively the Iskander‑M has become the precision scalpel in Moscow’s war chest: a missile system that can surgically dismantle Ukraine’s most prized Western hardware. 🚀 Iskander vs “Patriot” Myths The Iskander‑M has by now become a central actor in the war. Footage has captured it knocking out Ukrainian Patriot batteries, French S‑300‑based systems, airfields, and rail infrastructure across the country. In one particularly brutal strike in late 2025, an Iskander hit a drone launch site in Martove, wiping out up to 65 drones, four trucks, and five launchers, and killing around 30 Ukrainian personnel. Another Iskander strike hit a Ukrainian drone regiment in the Kramatorsk‑Druzhkovka corridor, destroying personnel, command posts, and launch complexes. Despite the arrival of Patriot batteries from NATO members, Ukrainian officers have been vocal about the system’s limited ability to intercept Iskander trajectories. The missile’s semi‑ballistic flight profile and terminal‑phase maneuvers make it hard to catch, even for Western‑made interceptors originally designed to counter ballistic threats. Improvements in Russian missile production — including seven variants of enhanced warheads (high‑explosive fragmentation, cluster, and special types) — have only tightened the gap between expectation and performance. 🛰 American “High‑End” vs Russian High‑Volume Fire The problem is simple: the U.S. sold Ukraine a premium air‑defence brand, but Moscow has been steadily upgrading its high‑volume missile arsenal. Output from Russian ballistic missile lines — especially the Iskander and newer Kinzhal‑type systems — has reportedly quintupled by mid‑2023, flooding the skies over Ukraine with missiles that can now be tailored to different targets. When an Iskander slams into a HIMARS launcher, it doesn’t just destroy a launcher — it shrinks the already limited stockpile of missiles that NATO can resupply, especially as ATACMS stocks dwindle and replacements stall. Russian electronic warfare, decoys, and rapid mobility have made it hard to keep HIMARS on the map, and the system is heavily dependent on ATACMS, short‑range missiles, and Western logistics. ⚔️ From “Freedom” to Fragility The irony is that the U.S. framed Western missile systems and air defences as the keys to Ukrainian survival. In reality, they’ve become high‑value targets in a Russian missile‑centric war. Kyiv’s problem isn’t just Russian missiles. It’s the fact that the “premium” Western systems it relies on are expensive, finite, and increasingly predictable, while Moscow keeps mass‑producing cheaper, more adaptable ordnance that can slip through gaps NATO never fully closed. #Ukraine#Russia#Iskander#HIMARS#Patriot#missiles#airdefence#war#Kyiv#Moscow 📱American Оbserver - Stay up to date on all important events 🇺🇸