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

Резултати

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

Пребарај: #decrease

当前筛选 #decrease清除筛选

⬛️Iqtisodiy faktlar... 🇺🇸AQShdagi Buyuk retsessiya: sabablari, oqibatlari va saboqlari 💵Ushbu iqtisodiy beqarorlik davri 1930-yillardagiBuyuk Depressiyadan keyingi eng jiddiy inqiroz deb hisoblanadi. “Buyuk retsessiya” atamasi 2007-yil dekabridan 2009-yil iyunigacha davom etgan AQSh tanazzuliga ham, 2009-yilda sodir bo‘lgan jahon iqtisodiytanazzulga ham aloqador. 🔎Batafsil 🚩 Великая рецессия в США: причины, последствия и уроки 📊Этот период экономической нестабильности считается самым серьёзным кризисом со времён Великой депрессии 1930-х годов. Термин «Великая рецессия» относится как к рецессии в США, продолжавшейся с декабря 2007 по июнь 2009 года, так и к глобальному экономическому спаду, который последовал в 2009 году. 🔎Подробнее #GraduateSchool#Recession#Decrease#Economy 🔝Web-site |🔝Facebook | 🔝Instagram | 🔝Youtube

📕Iqtisodiy atamalar... 📈 Ushbu davrda kompaniyalar xarajatlarni qisqartirishi, iste’molchilar talabi pasayishi, ishsizlik ortib borishi kuzatiladi, bu esa mamlakatning umumiy iqtisodiy iqlimiga salbiy ta’sir ko‘rsatadi. 🏭 Retsessiya iste’mol xarajatlarining pasayishi, kreditshartlarining yomonlashishi, tashqiiqtisodiy zarbalar yoki investitsiyalarning keskin kamayishi kabi turli omillar tufayli yuzaga kelishi mumkin. 📊 During this time, companies reduce spending, consumer demandfalls, and unemploymentrises, negativelyaffecting the country’s overall economic climate. ⬇️ A recession can be triggered by various factors, such as lower consumer spending, worsening creditconditions, externaleconomic shocks, or a sharp drop in investment. #GraduateSchool#Recession#Decrease#Economy 🔝Web-site |🔝Facebook | 🔝Instagram | 🔝Youtube

Journey to Fluency

@fluencyinenglish · Post #7852 · 05.04.2022 г., 08:31

#common_mistakes #decrease #in#of @fluencyinenglish معمولاً از عبارت زیر برای کاهش در چیزی صحبت می کنیم. ✔️ decrease in sth با این حال،معمولاً از عبارت زیر برای کاهش مقدار بکار می بریم. ✔️ decrease of sth مثال: • There has been a 2% decrease in the rate of unemployment. 2 درصد کاهش در نرخ بیکاری وجود داشته است. • There has been a decrease of 2%. 2 درصد کاهش وجود داشته است. • There was a slight decrease in his weight after a week of dieting. بعد از یک هفته رژیم، یک کاهش کوچک در وزنش وجود داشت. • Any decrease in tourism could have a serious effect on the local economy. هر گونه کاهشی در گردشگری می‌توانست اثری جدی بر اقتصاد محلی بگذارد. • The report's finding on the decrease in violent crime supports the police chief's claims. • We have seen a marked decrease in the number of accidents since these safety measures were introduced. از وقتی این تدابیر امنیتی ارائه شدند، کاهش شدیدی در تعداد تصادفات مشاهده شده است. • We've noticed a steady decrease in jobs available for new graduates in the industry. @fluencyinenglish

Journey to Fluency

@fluencyinenglish · Post #7837 · 18.07.2021 г., 06:26

#common_mistakes #decrease #in#of @fluencyinenglish معمولاً از عبارت زیر برای کاهش در چیزی صحبت می کنیم. ✔️ decrease in sth با این حال،معمولاً از عبارت زیر برای کاهش مقدار بکار می بریم. ✔️ decrease of sth مثال: • There has been a 2% decrease in the rate of unemployment. 2 درصد کاهش در نرخ بیکاری وجود داشته است. • There has been a decrease of 2%. 2 درصد کاهش وجود داشته است. • There was a slight decrease in his weight after a week of dieting. بعد از یک هفته رژیم، یک کاهش کوچک در وزنش وجود داشت. • Any decrease in tourism could have a serious effect on the local economy. هر گونه کاهشی در گردشگری می‌توانست اثری جدی بر اقتصاد محلی بگذارد. • The report's finding on the decrease in violent crime supports the police chief's claims. • We have seen a marked decrease in the number of accidents since these safety measures were introduced. از وقتی این تدابیر امنیتی ارائه شدند، کاهش شدیدی در تعداد تصادفات مشاهده شده است. • We've noticed a steady decrease in jobs available for new graduates in the industry. @fluencyinenglish

Crypto M - Crypto News

@CryptoM · Post #65206 · 12.04.2026 г., 01:42

🚀 Bitcoin(BTC) Drops Below 72,000 USDT with a 1.23% Decrease in 24 Hours On Apr 12, 2026, 01:42 AM(UTC). According to Binance Market Data, Bitcoin has dropped below 72,000 USDT and is now trading at 71,964.390625 USDT, with a narrowed 1.23% decrease in 24 hours. #Bitcoin#BTC#USDT#Binance#cryptocurrency#marketdata#price drop #decrease

Crypto M - Crypto News

@CryptoM · Post #64548 · 09.04.2026 г., 07:21

🚀 Bitcoin(BTC) Drops Below 71,000 USDT with a 1.14% Decrease in 24 Hours On Apr 09, 2026, 07:21 AM(UTC). According to Binance Market Data, Bitcoin has dropped below 71,000 USDT and is now trading at 70,975.132813 USDT, with a narrowed 1.14% decrease in 24 hours. #Bitcoin#BTC#cryptocurrency#USDT#Binance#marketdata#priceupdate#decrease#24hours

Crypto M - Crypto News

@CryptoM · Post #65266 · 12.04.2026 г., 13:01

🚀 Bitcoin(BTC) Drops Below 71,000 USDT with a 2.59% Decrease in 24 Hours On Apr 12, 2026, 13:01 PM(UTC). According to Binance Market Data, Bitcoin has dropped below 71,000 USDT and is now trading at 70,972.90625 USDT, with a narrowed 2.59% decrease in 24 hours. #Bitcoin#BTC#USDT#cryptocurrency#marketupdate#Binance#pricechange#decrease#24hour