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

Резултати

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

Пребарај: #texto

当前筛选 #texto清除筛选
BotsGram®

@botsgram_cu · Post #3743 · 31.03.2021 г., 13:57

¿Que puede hacer este bot? @QuotAfBot Crea pegatinas animadas con un texto que le envíes Idiomas: varios incluido español (Visto en @botsgram_cu) #stickers#texto

BotsGram®

@botsgram_cu · Post #4296 · 26.08.2021 г., 17:46

¿Que puede hacer este bot? @WebScrapperRoBot Con este bot puedes obtener todo el texto de un sitios web Idiomas: inglés (Visto en @botsgram_cu) #web#texto

Hashtags

BotsGram®

@botsgram_cu · Post #3093 · 27.10.2020 г., 02:57

¿Que puede hacer este bot? @TextChangerBot Un bot para convertir texto a varias fuentes. Perfecto para configurar perfiles en redes sociales, apodos para juegos y más. Idioma: ruso (Visto en @botsgram_cu) #texto#fuentes

BotsGram®

@botsgram_cu · Post #3061 · 11.10.2020 г., 05:40

¿Que puede hacer este bot? @COOLTEXTGENERATORBOT Bot para decorar y darle estilo al texto en muchas fuentes Idiomas: inglés (Visto en @botsgram_cu) #fuentes#texto

BotsGram®

@botsgram_cu · Post #4473 · 31.10.2021 г., 03:27

¿Que puede hacer este bot? @TypographicBot Este bot puede cambiar la tipografía de los mensajes que le envías Idiomas: inglés (Visto en @botsgram_cu) #texto#estilo

BotsGram®

@botsgram_cu · Post #4048 · 24.06.2021 г., 17:15

¿Que puede hacer este bot? @TheCarbonShBot Crea y comparte hermosas imágenes de su código fuente. Envíele un fragmento de código y le responderá con una bonita imagen de ese código. Idioma: inglés (soporta cualquier idioma en la conversión) (Visto en @botsgram_cu) #texto#fuente

BotsGram®

@botsgram_cu · Post #3946 · 27.05.2021 г., 15:19

¿Que puede hacer este bot? @BettergramBot Crea textos creativos con fuentes personalizadas. Idiomas: inglés (Visto en @botsgram_cu) #texto#fuente

BotsGram®

@botsgram_cu · Post #3738 · 30.03.2021 г., 18:54

¿Que puede hacer este bot? @MasquerBot Este bot utiliza un algoritmo de cifrado de última generación y manipulación de píxeles para enmascarar cualquier texto dentro de cualquier imagen dada. Idioma: inglés (Visto en @botsgram_cu) #edición#fotos#texto

BotsGram®

@botsgram_cu · Post #4002 · 10.06.2021 г., 13:19

¿Que puede hacer este bot? @bacakubot Con este bot podrás extraer texto de una imagen o foto y traducirlo a cualquier idioma Idiomas: inglés (Visto en @botsgram_cu) #texto#imágenes#traductor

BotsGram®

@botsgram_cu · Post #4903 · 06.09.2023 г., 13:44

¿Que puede hacer este bot? 🤖@IMG2TEXTBot 📎Este bot utiliza el reconocimiento óptico de caracteres (OCR) para detectar texto en imágenes. #Imagen#texto#IA ( Visto en: @BotsGram_Cu )

BotsGram®

@botsgram_cu · Post #4950 · 29.03.2024 г., 13:02

¿Qué puede hacer este bot? 🤖@Ai_Text2Speechbot Es una herramienta fácil de usar que transforma texto escrito en audio hablado. Utiliza algoritmos avanzados de síntesis de voz para generar un habla precisa y con un sonido natural con gran variedad de acentos, para que puedas disfrutar de una experiencia auditiva de alta calidad. Además, es fácil de usar: simplemente envíe un texto escrito al bot y generará un archivo de audio en segundos. Idiomas: Más de 50 idiomas #ia#tts#voz#texto (Visto en @BotsGram_Cu)

12
ПретходнаСтраница 1 од 2Следна