@TFGames · Post #1728 · 29.12.2023 г., 16:31
#AS#LEGENDS#GAMES https://testflight.apple.com/join/wxjeQtBy
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
Пребарај: #legends
@TFGames · Post #1728 · 29.12.2023 г., 16:31
#AS#LEGENDS#GAMES https://testflight.apple.com/join/wxjeQtBy
@googlefactss · Post #39958 · 27.10.2025 г., 23:01
Today, exactly 100 years ago on the 28th of October 1925 the mask of Tutankhamun was discovered. There was a legend that those who disturbed the tomb would be cursed, soon after the discovery and disturbance of the tomb certain incidents in wich members of the team started dying made it seem that this legend was true. [read more here] @googlefactss#history#funfact#Egypt#legends
@TFGames · Post #1664 · 26.12.2023 г., 18:48
#TACTIC#LEGENDS#GAMES https://testflight.apple.com/join/OnRQLDUN
@interesting_planet_facts · Post #1319 · 27.02.2026 г., 12:11
🌎 The legend of Yamata no Orochi comes from ancient Japanese mythology and describes an enormous eight-headed, eight-tailed serpent defeated by the god Susanoo. According to the Kojiki and Nihon Shoki texts from the 8th century CE, Susanoo discovered the creature in Izumo Province and tricked it with sake before slaying it. Archaeological evidence indicates these texts are among Japan’s oldest written records. ✨ #mythology⚡#Japan⚡#legends 👉subscribe Interesting Planet 👉more Channels
Hashtags
@interesting_planet_facts · Post #631 · 26.08.2025 г., 03:22
🌎 Ireland’s legend of the Salmon of Knowledge tells of a magical fish that granted wisdom to whoever tasted it. In Celtic mythology, eating this salmon gave the poet Fionn mac Cumhaill extraordinary wisdom, making him a great hero in Irish folklore. ✨ #mythology⚡#legends⚡#folklore 👉subscribe Interesting Planet
Hashtags
@interesting_planet_facts · Post #922 · 17.10.2025 г., 12:11
🌎 On the island of Flores in Indonesia, local legend tells of the Ebu Gogo—small, hairy people said to steal food and mimic speech. In 2003, scientists discovered Homo floresiensis fossils nearby, a tiny ancient human species, fueling debate about whether the myth preserves a memory of real prehistoric encounters. ✨ #legends⚡#anthropology⚡#indonesia 👉subscribe Interesting Planet 👉more Channels
Hashtags
@TFGames · Post #2038 · 01.02.2024 г., 01:49
#TRAVIAN#LEGENDS#MOBILE https://testflight.apple.com/join/QLm2zhZz
@sarconsulurals · Post #3078 · 27.01.2026 г., 02:47
🗺🐍Grootslang (Afrikaans and Dutch for “big snake”) is a legendary creature said to dwell in a deep cave in the Richtersveld region of northwestern South Africa, fiercely guarding its diamonds 💎 from treasure seekers. According to myth, the Grootslang was so powerful and cunning that the gods who created Earth decided to split it into two separate species — the elephant🐘 and the snake. 🐍 Yet some Grootslangs, the legends say, escaped into the deepest cave, where they have survived to this day. The cave is filled with diamonds 💎, but no one can reach them — the creature keeps watch day and night. 🌑✨ #Culture#Myths#SouthAfrica#Africa#Legends#Wildlife
@googlefactss · Post #40775 · 11.03.2026 г., 15:04
Flexible glass was a legendary type of glass from ancient Rome. A craftsman is said to have invented it, and it could supposedly bend without breaking. He showed it to Emperor Tiberius, who reportedly asked him to confirm he was the only one who knew how to make it. The emperor then had him executed to prevent the invention from spreading, an early example of planned obsolescence. No known examples survive today. 🏺🪞📜 [Read more] @googlefactss #FlexibleGlass#AncientRome#History#Legends#Innovation
@interesting_planet_facts · Post #757 · 15.09.2025 г., 20:22
🌎 The Mapuche people of southern Chile and Argentina have long told of the mythical “Pillán,” powerful spirits linked to volcanoes and natural disasters. Early European chroniclers in the 16th century recorded beliefs that eruptions were caused by these spirits’ anger. The word “pillán” still appears in many local place names near active volcanoes. ✨ #Mapuche⚡#mythology⚡#volcanoes⚡#legends 👉subscribe Interesting Planet
@TFGames · Post #1475 · 11.12.2023 г., 19:04
#CAT#LEGENDS#IDLE#RPG#GAMES https://testflight.apple.com/join/Ewprd8hL
@TFGames · Post #2138 · 09.02.2024 г., 13:05
#AS#MOBILE#5V5#LEGENDS#SHOOTER#GAMES https://testflight.apple.com/join/kAi3yDj6