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

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #380 · 21 окт.

Регулярно приходится писать и ревьюить код, где используется PySide2-6. Заметил, что в подавляющем большинстве случаев настройка создаваемых базовых виджетов происходит через методы. Думаю, всем знаком такой способ. Простой пример с кнопкой: button = QPushButton("Click Me") button.setMinimumWidth(300) button.setFlat(True) button.setStyleSheet("font-size: 20pt") button.setToolTip("Super Button") button.clicked.connect(lambda: print("Button clicked")) Но есть и альтернативный способ - настройка через свойства. Это просто ключевые аргументы конструктора класса. Хоть они и не указаны в документации как аргументы, но они есть) Этот код делает тоже самое но с помощью Property button = QPushButton( "Click Me", minimumWidth=300, flat=True, styleSheet="font-size: 20pt", toolTip="Super Button", clicked=lambda: print("Button clicked"), ) Где это может быть полезно ▫️ Это выглядит более аккуратно и коротко, уже повод использовать ▫️ Может использоваться в заполнении лейаута, когда нам не нужно никакое другое взаимодействие с виджетом и поэтому сохранять его в переменную не требуется. Например, лейбл или кнопка. widget = QWidget(minimumWidth=400) layout = QHBoxLayout(widget) layout.addWidget(QLabel("Button >", alignment=Qt.AlignRight)) layout.addWidget(QPushButton("Click Me", clicked=lambda: print("Button clicked"))) widget.show() Либо так widget = QWidget(minimumWidth=400) layout = QHBoxLayout(widget) for wd in ( QLabel("Button >", alignment=Qt.AlignRight), QPushButton("Click Me", clicked=lambda: ...) ): layout.addWidget(wd) widget.show() ▫️ Можно хранить настройки в каком-то конфиге или генерировать на лету, после чего передавать как kwargs. kwargs = {"text": "Hello " * 30, "wordWrap": True} my_label = QLabel(**kwargs) Как получить полный список доступных свойств? Эта функция распечатает в терминал все свойства виджета и их текущие значения def print_widget_properties(widget): meta_object = widget.metaObject() for i in range(meta_object.propertyCount()): property_ = meta_object.property(i) property_name = property_.name() property_value = property_.read(widget) print(f"{property_name}: {property_value}") #tricks#qt

Hashtags

Резултати

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

Пребарај: #xml

当前筛选 #xml清除筛选
help florin закрыт

@HELPFLORIN · Post #6490 · 20.02.2023 г., 00:43

𖥻 🍵 ›› ֗ . . ✦ › › xml by @korolevalalin ➫ 𝘁𝗮𝗴𝘀 — #xml (ⲃ ⲕⲟⲙⲙ.)) `` взяⲗυ ♡゙ — ‹ + › ⲃ ⲕⲟⲙⲙ.

Hashtags

help florin закрыт

@HELPFLORIN · Post #6291 · 06.02.2023 г., 22:01

𖥻 🍵 ›› ֗ . . ✦ › › xml by @korolevalalin ➫ 𝘁𝗮𝗴𝘀 — #xml (ⲃ ⲕⲟⲙⲙ.)) `` взяⲗυ ♡゙ — ‹ + › ⲃ ⲕⲟⲙⲙ.

Hashtags

ALL About RSS

@AboutRss · Post #776 · 21.08.2020 г., 07:30

#教程 「Building a web scraping tool with Python」 6月发出第一篇的信息爬取系列教程终于在八月完结,其中第一篇讲如何用 #Python 解析 #XML 格式的 RSS feed。总共有三篇: 1️⃣Building an RSS feed scraper with Python 2️⃣Automated web scraping with Python and Celery 3️⃣Making a web scraping application with Python, Celery, and Django https://codeburst.io/building-an-rss-feed-scraper-with-python-73715ca06e1f 发现于 https://twitter.com/RSSCircus/status/1271810732225593346 题图来自 DataCamp。

Oneplus 13 Updates

@OnePlus13Series · Post #369 · 15.01.2026 г., 09:19

LM.CCD config adapted for OnePlus 13 ⬇️ Download Gcam App (pick aweme variant) What's Working : Main, Telephoto, Selfie, UW, Night Sight, Portrait, Videography (4k 60fps + Stabilization) Changelogs : • Based on LM.CCD_v3_Sabre config by LaoMa • Upscaling is enabled by default for Selfie Camera • Removed extra profiles (which i felt useless) • Miscellaneous small tweaks done by me. XML (.agc) Save Directory: /Download/AGC 9.2/configs All credit goes to the original creator of the config. #gcam#xml#agc 👤 Adapted by: @pulkittg 🔔 Updates: @OnePlus13Series 💬 Discussion: @OnePlus13SeriesChatRoom

djangoproject

@djangoproject · Post #547 · 14.01.2018 г., 21:44

https://stackoverflow.com/questions/3224268/python-unicode-encode-error Python #Unicode#Encode Error I'm reading and parsing an Amazon #XML file and while the XML file shows a ' , when I try to print it I get the following error:

djangoproject

@djangoproject · Post #408 · 10.08.2017 г., 10:42

https://docs.python.org/3/library/xmlrpc.html #XML-#RPC is a #Remote_Procedure_Call method that uses XML passed via #HTTP as a transport. With it, a #client can call methods with parameters on a remote server (the #server is named by a URI) and get back structured data. #xmlrpc is a package that collects server and client modules implementing XML-RPC. The modules are: xmlrpc.client xmlrpc.server

djangoproject

@djangoproject · Post #551 · 23.01.2018 г., 16:28

http://lxml.de/ #lxml is the most feature-rich and easy-to-use library for processing #XML and #HTML in the Python language. The lxml XML toolkit is a Pythonic binding for the #C libraries #libxml2 and #libxslt. It is unique in that it combines the speed and XML feature completeness of these libraries with the simplicity of a native Python #API, mostly compatible but superior to the well-known ElementTree API. The latest release works with all #CPython versions from 2.6 to 3.6. See the introduction for more information about background and goals of the lxml project. Some common questions are answered in the FAQ.