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

Резултати

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

Пребарај: #revanced

当前筛选 #revanced清除筛选

🗂️【应用名称】:🟥YouTube ReVanced [Extended] 📱【适用平台】:#Android 📌【软件标签】:#YouTube#ReVanced ☑【应用版本】:18.46.45 ➡️ 16.45 ➡️ 19.03.32 🔩【应用大小】:100MB 🔺【软件说明】:软件升级更新。ReVanced Extended与常规 Reed Extended与常规 Reed Extended与常规 ReVVananancced相比,它具有ed相比,它具有ed相比,它具有额外的功能,具有“广告拦截”、SponsorBlock、后台播放、画中画、深色主题、滑动控制音量和亮度调整以及恢复不喜欢计数等内置功能。 🔘 如何安装: 🔵首先安装MicroG MicroG➡️点击下载 (新版,V8a或V7a自行选择) 🔵然后安装You7a自行选择) 🔵然后安装YouTube ReVanced 🔵打开 YouTube ReVanced 🔵登录您的谷歌账户 🟡如果安装过MicroG并且登录过,直接下载使用即可 🥰内置模块使用方法:打开apapp后,依次点击:左下角媒体库➡️右上角个人头像➡️设置➡️点击ReVanced Extended ✔下载指南(必看):请先加入储存频道【➡点击加入 】,然后点击下方下载地址下载地址即可跳转 ❤资源指南:😥电脑|🚀VPN|🤖备份|👍群聊|♥投稿 ⬇️下载地址➡️点击下载(V8a或V7a自行选择) ⭐更多软件分享:@OOAPK 消息来源: https://t.me/OOAPK/9068

Libreware

@libreware · Post #1515 · 23.10.2025 г., 22:21

The App That Google Couldn’t Shut Down https://www.youtube.com/watch?v=Vlc255SwBXw ReVanced Manager is an application that uses ReVanced Patcher to patch Android apps. 💪 Features 💉Patch apps: Apply any patch of your choice to Android apps 📱Portable: ReVanced Patcher that fits in your pocket 🤗Simple UI: Quickly understand the ins and outs of ReVanced Manager 🛠️Customization: Configurable API, custom sources, language, signing keystore, theme and more 🔽 Download You can download the most recent version of ReVanced Manager at revanced.app/download or from GitHub releases. Learn how to use ReVanced Manager by following the documentation. Another option: https://rvxapp.com #yt#YouTube#Vanced#revanced

Libreware

@libreware · Post #1425 · 02.03.2025 г., 01:27

ReVanced https://revanced.app Download https://github.com/ReVanced/revanced-manager/releases ReVanced Documentation https://github.com/ReVanced/revanced-documentation Patches https://revanced.app/patches https://github.com/revanced https://t.me/app_revanced Revanced magisk module https://github.com/j-hc/revanced-magisk-module https://t.me/rvc_magisk #revanced#vanced#video#yt#android

GitHub Trends

@githubtrending · Post #15140 · 13.09.2025 г., 11:30

#java#android#dalvik#kotlin#patches#revanced#reverse_engineering ReVanced Patches let you customize Android apps by adding new features, blocking ads, changing how apps look, and more. You can remove annoying ads, personalize app themes, enable background playback, and unlock extra controls. Using tools like ReVanced Manager, you can easily apply these patches without technical hassle. This means you get a cleaner, more enjoyable app experience, especially for apps like YouTube, without paying for premium versions. It also supports ongoing updates and a community that keeps improving it, so your apps stay fresh and tailored to your needs. https://github.com/ReVanced/revanced-patches

GitHub Trends

@githubtrending · Post #15023 · 02.08.2025 г., 00:00

#dart#android#flutter#flutter_apps#manager#modding#patching#revanced ReVanced Manager is an app for Android that lets you customize and patch other apps, like YouTube, to remove ads and add features without needing subscriptions. It is easy to use, works on both rooted and non-rooted devices, and offers many options to tailor apps to your liking. You download the official app, then apply patches you want, creating a personalized, ad-free experience. This saves you money and improves app use while staying legal and supported by an active community. It is lightweight, regularly updated, and has a simple interface, making app customization safe and convenient[1][3][5]. https://github.com/ReVanced/revanced-manager