@EuropeanTribalism · Post #856 · 22.05.2021 г., 14:23
After a successful hunt, the killed prey is placed on a bed of pine needles to honour it. #hunting @EuropeanTribalism
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
Пребарај: #hunting
@EuropeanTribalism · Post #856 · 22.05.2021 г., 14:23
After a successful hunt, the killed prey is placed on a bed of pine needles to honour it. #hunting @EuropeanTribalism
Hashtags
@TestFlightX · Post #34336 · 19.10.2024 г., 17:01
#MYHUNT#HUNTING#APP https://testflight.apple.com/join/gAhUD9w1
@EuropeanTribalism · Post #483 · 08.06.2020 г., 03:41
Today I have a little lesson about hunting knives for you. Those knives are free and easy to get, require just little storage space and require almost no maintenance. In any case it will be good to have such a set. On the right side there is a knife you need first after bringing down your prey. (As an example we will use deer.) Use the big sharp blade to cut the biggest parts and the little hooked blade on the back to open the skin on thorax and abdomen. Next you would need the middle knife for making smaller, more precise cuts. Also for smaller prey like rabbits this type is useful to precisely cut around lymph nodes. The tool on the left is a dedicated bonesaw to open the ribcage from the front, which is helpful in any case to reach the organs. After usage these tools need to be cleaned with water. (In some cases you would need soap, for example when you accidentally cut intestines or rumen. #survival#hunting#tools @EuropeanTribalism
@interesting_planet_facts · Post #573 · 16.08.2025 г., 20:22
🌎 The bolas spider swings a sticky silk “lure” scented like female moths to attract unsuspecting mates—then snags them midair in a single swoop! ✨ #spider⚡#mimicry⚡#hunting 👉subscribe Interesting Planet
@airdrop_presents · Post #803 · 07.03.2022 г., 08:20
@MetaShooter_gg is running a LEGENDARY $100,000 MYSTERY BOX campaign! Join our gleam competition: 🔗https://gleam.io/Op3lz/metashoote 📃 Follow all the rules and tag your friends to join the airdrop campaign! #NFT#ADA#Metaverse#Giveaway#P2E#Cardano#playtoearn#hunting#airdrop#playtoearn Website | Twitter | Telegram | Announcements | Discord | Medium | Instagram | Youtube | TikTok | Reddit | Facebook
@WangZhuanZhan · Post #34529 · 28.10.2024 г., 14:09
L-l猎l头t- 猎头 (1982) 直达链接:https://pan.quark.cn/s/7ef305b73e40 #猎头#再见江湖 #豪情杀手#夺命枪手 #Hunting Head #Long Goodbye #飚情杀手 链接:https://link3.cc/sf_com #电影#爱情#内地#80年代