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

Резултати

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

Пребарај: #relaxation

当前筛选 #relaxation清除筛选
Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40384 · 22.12.2025 г., 11:01

Heated water has helped people relax and heal for thousands of years. Ancient cultures like Japan and Rome used natural hot springs and made early tubs with hot stones and pipes. The Jacuzzi brothers, Italian inventors in California, created the first submersible pump and later a hydrotherapy pump in 1956 to ease arthritis pain. In 1968, Roy Jacuzzi made the first whirlpool bath with jets, starting modern hot tubs as places for health and social fun.♨️🛁 [Source] @googlefactss#HotTubs#Jacuzzi#Hydrotherapy#Relaxation

🇨🇺 Anuncios-cu | Publicitaria

@anuncios_cu · Post #5229 · 21.06.2025 г., 20:50

🌟 ¿Te has preguntado alguna vez cuán importante es el masaje en nuestra vida diaria? 🌟 ⁣ En un mundo donde el estrés y la rutina nos abruman, los masajes se han convertido en una herramienta esencial para el bienestar físico y mental. No solo ayudan a aliviar la tensión muscular, sino que también promueven la relajación, mejoran la circulación y contribuyen a un estado general de felicidad. En Elis Massage, entendemos la importancia de cuidar de ti mismo, por eso ofrecemos servicios de masajes 💆 a domicilio, llevándote la experiencia del spa directamente a tu hogar. Desde masajes relajantes hasta terapias específicas, nuestro equipo está preparado para adaptarse a tus necesidades y brindarte un momento de paz y renovación. ¡Regálate el placer de un buen masaje sin salir de casa! 💆‍♀️💖 ••••••••••••• 🔺 ••••••••••••• Promocionado por Anuncios-cu.com •••••••••••••••••••••••••••••••• #MasajesADomicilio#Bienestar#ElisMassage#Relajación#CuidadoPersonal#MasajeRelajante#Bienestar#Cuba#Havana#Masaje#Masoterapia#Bienestar#Salud#TerapiaDeMasaje#MasajeDeportivo#terapiaholi‌stica#EstiloDeVidaSaludable#AutoCuidado#MasajeAromaterapia#Spa#MasajeEnCasa#Massage#MassageTherapy#Wellness#Relaxation#Health#SelfCare#SpaDay#aromatherapymassage#DeepTissueMassage#SportsMassage#HolisticHealing#Vacation#massagetime#massagetherapy 👀Para más información escribe al pv https://wa.me/+5363719629 y será atendid

🇨🇺 Anuncios-cu | Publicitaria

@anuncios_cu · Post #5162 · 19.05.2025 г., 21:38

🌟 ¿Te has preguntado alguna vez cuán importante es el masaje en nuestra vida diaria? 🌟 ⁣ En un mundo donde el estrés y la rutina nos abruman, los masajes se han convertido en una herramienta esencial para el bienestar físico y mental. No solo ayudan a aliviar la tensión muscular, sino que también promueven la relajación, mejoran la circulación y contribuyen a un estado general de felicidad. En Elis Massage, entendemos la importancia de cuidar de ti mismo, por eso ofrecemos servicios de masajes 💆 a domicilio, llevándote la experiencia del spa directamente a tu hogar. Desde masajes relajantes hasta terapias específicas, nuestro equipo está preparado para adaptarse a tus necesidades y brindarte un momento de paz y renovación. ¡Regálate el placer de un buen masaje sin salir de casa! 💆‍♀️💖 ••••••••••••• 🔺 ••••••••••••• Promocionado por Anuncios-cu.com •••••••••••••••••••••••••••••••• #MasajesADomicilio#Bienestar#ElisMassage#Relajación#CuidadoPersonal#MasajeRelajante#Bienestar#Cuba#Havana#Masaje#Masoterapia#Bienestar#Salud#TerapiaDeMasaje#MasajeDeportivo#terapiaholi‌stica#EstiloDeVidaSaludable#AutoCuidado#MasajeAromaterapia#Spa#MasajeEnCasa#Massage#MassageTherapy#Wellness#Relaxation#Health#SelfCare#SpaDay#aromatherapymassage#DeepTissueMassage#SportsMassage#HolisticHealing#Vacation#massagetime#massagetherapy 👀Para más información escribe al pv https://wa.me/+5363719629 y será atendid

🇨🇺 Anuncios-cu | Publicitaria

@anuncios_cu · Post #5067 · 13.04.2025 г., 09:26

🌟 ¿Te has preguntado alguna vez cuán importante es el masaje en nuestra vida diaria? 🌟 ⁣ En un mundo donde el estrés y la rutina nos abruman, los masajes se han convertido en una herramienta esencial para el bienestar físico y mental. No solo ayudan a aliviar la tensión muscular, sino que también promueven la relajación, mejoran la circulación y contribuyen a un estado general de felicidad. En Elis Massage, entendemos la importancia de cuidar de ti mismo, por eso ofrecemos servicios de masajes 💆 a domicilio, llevándote la experiencia del spa directamente a tu hogar. Desde masajes relajantes hasta terapias específicas, nuestro equipo está preparado para adaptarse a tus necesidades y brindarte un momento de paz y renovación. ¡Regálate el placer de un buen masaje sin salir de casa! 💆‍♀️💖 ••••••••••••• 🔺 ••••••••••••• Promocionado por Anuncios-cu.com •••••••••••••••••••••••••••••••• #MasajesADomicilio#Bienestar#ElisMassage#Relajación#CuidadoPersonal#MasajeRelajante#Bienestar#Cuba#Havana#Masaje#Masoterapia#Bienestar#Salud#TerapiaDeMasaje#MasajeDeportivo#terapiaholi‌stica#EstiloDeVidaSaludable#AutoCuidado#MasajeAromaterapia#Spa#MasajeEnCasa#Massage#MassageTherapy#Wellness#Relaxation#Health#SelfCare#SpaDay#aromatherapymassage#DeepTissueMassage#SportsMassage#HolisticHealing#Vacation#massagetime#massagetherapy 👀Para más información escribe al pv https://wa.me/+5363719629 y será atendid