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

Резултати

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

Пребарај: #makeinindia

当前筛选 #makeinindia清除筛选
Indian Development News 🇮🇳

@developmentnewsindia · Post #44266 · 01.05.2026 г., 02:20

Carrier Global to invest ₹863 crore in Sri City plant for chiller systems; project to create 721 jobs. Move aligns with Andhra Pradesh 6 GW data centre target, localising cooling infra for hyperscale facilities and reducing supply chain dependence. #MakeinIndia

Hashtags

Indian Development News 🇮🇳

@developmentnewsindia · Post #44220 · 30.04.2026 г., 06:19

🇷🇺🤝🇮🇳 Rosatom deploys RusBeam 2800 industrial 3D printer in India using EBAM technology for aerospace components. System can produce metal parts up to ~2.8 m and ~4 tonnes, marking entry into India’s additive manufacturing market. #MakeInIndia https://t.co/BNRzsaWaUx

Hashtags

Indian Development News 🇮🇳

@developmentnewsindia · Post #44080 · 26.04.2026 г., 06:04

Azad Engineering inaugurates 7,600 sq m Hyderabad facility to support Baker Hughes global supply chain. Plant is its 4th unit, integrated with Centre of Excellence; partnership with Baker Hughes spans ~8 years. Focus on aerospace, defence, energy manufacturing expansion. #MakeInIndia https://t.co/ZxbXjq1xQo

Hashtags

Indian Development News 🇮🇳

@developmentnewsindia · Post #43904 · 22.04.2026 г., 04:21

🇮🇳🤝🇯🇵Now, JSW has brought in another partner, Japan’s JFE Steel, with a combined ₹30,000 crore investment in Odisha. This JV with JFE will expand Bhushan Power & Steel (BSPL) to 10 MTPA capacity. JSW’s upcoming steel projects in Odisha: 1. Paradip - 13.2 MTPA (WIP) 2. Keonjhar - 5 MTPA 3. Dhenkanal - 6 MTPA 4. Sambalpur - 6 MTPA expansion (from 4 to 10 MTPA) #MakeInIndia

Hashtags

Indian Development News 🇮🇳

@developmentnewsindia · Post #43788 · 18.04.2026 г., 15:24

JSW Steel has approved a joint venture with South Korea’s POSCO Group to set up a 6 MTPA integrated steel plant in Odisha. The project will be executed through Saffron Resources, which will become a 50:50 JV between the two companies. This JV is for the Keonjhar steel plant. #MakeInIndia

Hashtags

Indian Development News 🇮🇳

@developmentnewsindia · Post #43591 · 14.04.2026 г., 14:09

Karnataka plans Mandya industrial hub with ARAI facility; ecosystem size proposed ~500 acres vs initial 100 acres. Site options include ~105 acres at Basaralu and ~425 acres at Bellur; separate proposal seeks 2,550 acres for electrical equipment manufacturing. #MakeInIndia

Hashtags

Indian Development News 🇮🇳

@developmentnewsindia · Post #43393 · 09.04.2026 г., 03:33

Japan's Daikin Industries is setting up its first R&D centre outside Japan in India . The ₹1,000 crore hub will be focused on chillers and AC systems for data centres, residential, and commercial use. The centre, likely near its existing Neemrana plant, will hire 500 engineers from top Indian institutions. Beyond R&D, Daikin is also building a compressor plant, setting up a local refrigerant production entity, and investing ₹200 crore to locally manufacture data centre chillers #MakeInIndia

Hashtags

MyGov Newsdesk

@MyGovCoronaNewsdesk · Post #13382 · 22.04.2025 г., 05:43

Indian Automobiles, Global Dreams! 🌍🚗 India’s auto exports race ahead with a massive 73% surge from 2014 to 2025! #MakeInIndia

Hashtags

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