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 слични објави

Пребарај: #newpipe

当前筛选 #newpipe清除筛选
📱Play Market +

@pm_plus · Post #33243 · 10.03.2026 г., 18:12

NewPipe (YouTube Premium) 🆕Обновление Неофициальный клиент для популярного сервиса YouTube со всеми преимуществами Premium версии. Нет рекламы и доступно фоновое воспроизведение. ⚙️Полная Premium версия, вырезана реклама, доступно скачивание видео и аудио. #YouTube@pm_plus #NewPipe@pm_plus 📱Play Market + ⚡️ НАШ ЧАТ

Libreware

@libreware · Post #896 · 07.02.2021 г., 13:33

NewPipe x SponsorBlock A fork of NewPipe with SponsorBlock functionality. The implementation is still a bit basic but it generally works pretty well. 💡 How can I get this? Builds will be uploaded in the Releases section. Please download the APK from the newest release and install it on your device. 💡 Why isn't this in upstream NewPipe? The developer team behind the official NewPipe decided that they do not want to include this kind of functionality in their app. See https://newpipe.schabi.org/blog/pinned/newpipe-and-online-advertising/ and https://github.com/TeamNewPipe/NewPipe/pull/3205 for more information and discussion. We obviously disagree but we respect their decision and continue to offer SponsorBlock in NewPipe via this fork. https://github.com/polymorphicshade/NewPipe#newpipe-x-sponsorblock #newpipe#sponsorblock

Libreware

@libreware · Post #933 · 26.04.2021 г., 21:35

NewPipe Releases (unofficial) - NewPipe's GitHub releases The APK sent here cannot be installed over F-Droid's one because they use different signing keys (details) This pull request adds an experimental SponsorBlock integration, the fork's apk is linked there 👉🏼https://t.me/newpipe_releases👈🏼 💡 read this as well: YouTube video hosting alternatives https://t.me/NoGoolag/2284 #newpipe#youtube#alternatives 📡@libreware📡@nogoolag

Libreware

@libreware · Post #1198 · 02.11.2023 г., 04:37

BraveNewPipe A libre lightweight streaming front-end for Android Due to restrictive project policy, the #NewPipe team refuses to add platforms that they find offensive. This fork (BraveNewPipe) will not be as restrictive. As long as the platforms work in the spirit of free speech, they could be integrated. Nevertheless, platforms that promote pornography or other degrading things will NOT be included here. Contribute This fork will focus only on integrating other platforms. Unrelated patches will be rejected for now. Feel free to suggest which alternative platforms should be included. Any contribution (development/testing/bug report) is greatly appreciated. Which additional platforms are supported? Bitchute Rumble Other features not found in NewPipe -NewPipe x Sponsorblock into this fork -searchfilters: in the action menu of the search page you can now change the search behavior for the actual search. The supported content/sort filters depend on the service https://github.com/bravenewpipe/NewPipe Download https://github.com/bravenewpipe/NewPipe/releases #yt#video#streaming

GitHub Trends

@githubtrending · Post #15452 · 29.01.2026 г., 19:00

#java#4k#android#bandcamp#download_videos#newpipe#peertube#soundcloud#translation#video#watch#youtube_video NewPipe is a free, open-source Android app for ad-free streaming and downloading videos/audio from YouTube, SoundCloud, PeerTube and more, with background play, pop-up mode, subscriptions without accounts, and no Google tracking for full privacy. The team is rewriting the code for a modern, stable version—download nightly builds to try new features early. This benefits you by saving data/battery, enabling offline/multitasking use, and protecting your data on any device. https://github.com/TeamNewPipe/NewPipe