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

Резултати

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

Пребарај: #sylviamiami

当前筛选 #sylviamiami清除筛选

Post 🇫🇷 & 🇺🇸 🇫🇷🚨📣 Mike Pompeo APPLAUDI pour avoir demandé que les livres d’histoire ne parlent pas des victimes de Gaza…👀🤔 L'ancien secrétaire d'État américain Mike Pompeo a déclaré, lors d'une conférence pro-israélienne, qu'il fallait veiller à ce que les livres d'histoire "ne parlent pas des victimes de Gaza". Applaudi par l'audience, il a affirmé que les "véritables victimes" étaient les Israéliens. 🟢 Rappel - La Floride sous Influence Étrangère… 👉https://t.me/sylviamiamiofficiel/5377 🇺🇸🚨📣 Mike Pompeo APPLAUDED for asking that history books not speak about the victims of Gaza… 👀🤔…()…👇 📍Source 👉 nouvelleaubefr ♦️sur X 👉 https://x.com/sylviamiami1776/status/2011514042397941874?s=46&t=sxY0HSCpYKEdPDgmFgbPCQ 🇺🇸🦅🇫🇷 Sylvia Miami 👉linkmix.co/20609370 #SylviaMiami

Hashtags

Post 🇫🇷 & 🇺🇸 🇫🇷🚨📣 Epstein Files : le nom de Madeleine McCann apparaît 🥹…👇 Le nom de la petite Madeleine McCann apparaît dans les documents de l’affaire Epstein concernant Ghislaine Maxwell, « l’associée d’Epstein ». Quand Madeleine a disparu en 2007 au Portugal, un portrait-robot de suspect montrait une femme ressemblant fortement à Ghislaine Maxwell. Selon les fichiers Epstein, en septembre 2009, Ghislaine Maxwell aurait été vue avec une enfant correspondant à la description de Madeleine, deux ans après sa disparition… 🇺🇸🚨📣 Epstein Files: The name of Madeleine McCann appears 🥹…👇 📍 Source Emelia Rjl ♦️ Post sur X 👉 https://x.com/sylviamiami1776/status/2022622365281091796?s=46&t=sxY0HSCpYKEdPDgmFgbPCQ 🇺🇸🦅🇫🇷 Sylvia Miami 👉linkmix.co/20609370 #SylviaMiami #EpsteinFiles#MadeleineMcCann

🥹🚨📣 Olivier Ferrand (97 % de son corps brûlé à 9 ans), alias Captain Icarus, inspire et conseille les victimes de brûlures, dont celles de Crans-Montana. Faites passer son message 🙏🕊️ #cransmontana#brulure#aide#réveillon#incendie 📌association burns and smiles 📌association des brûlés de France 📌flavie association ♦️ Post sur X ➡️ https://x.com/sylviamiami1776/status/2008463123145969800?s=46&t=sxY0HSCpYKEdPDgmFgbPCQ 🇺🇸🦅🇫🇷 Sylvia Miami 👉linkmix.co/20609370 #SylviaMiami

🍑🍆😍PÉDO-CRIMINALITÉ💗👶🔞 ET SI LA VÉRITÉ LA PLUS SOMBRE SE CACHAIT SOUS NOS PIEDS ? 3 juin 2025 Post 🇫🇷 & 🇺🇸 🇫🇷🚨📣 Les nouveaux documents déclassifiés de l’affaire Epstein révèlent que, je cite : « des suprémacistes juifs comme Epstein nous considèrent comme du bétail, des Goyim nés uniquement pour les servir. » 🎥 ÉCOUTEZ avec attention cette courte vidéo jusqu’au bout👀🔥 🇺🇸🚨📣 The newly declassified documents from the Epstein case reveal, I quote: “Jewish supremacists like Epstein see us as cattle Goyim who are born only to serve them.” 🎥 WATCH this short video carefully until the end 👀🔥 📍Source KagDrogo ♦️ sur X ➡️ https://x.com/sylviamiami1776/status/2018620480240996560?s=46&t=sxY0HSCpYKEdPDgmFgbPCQ 🇺🇸🦅🇫🇷 Sylvia Miami 👉linkmix.co/20609370 #SylviaMiami #Trump#Epstein #Rothschilds #JPMorgan#BlackRock #Ukraine#Goyim