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

Резултати

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

Пребарај: #nwo

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

@developmentnewsindia · Post #44329 · 02.05.2026 г., 10:27

Breaking: At the Peace Dialogues held between Pakistan and Afghanistan in Turkey, IHH, the org hosting the dialogue in Turkey, removed PoK, Balochistan and parts of Khyber Pantukhwa from Pakistan's map. #NWO#Geopolitics

Indian Development News 🇮🇳

@developmentnewsindia · Post #43826 · 20.04.2026 г., 04:43

BREAKING 🇦🇪⚡🇺🇸 A post on X by Abdulkhaleq Abdullah, adviser to the UAE president: “The UAE no longer needs the United States to defend it, as it has proven during Iranian aggression that it is fully capable of defending itself with competence.” “It is time to consider closing U.S. bases in the Arabian Gulf, as they are a burden on the UAE.” #Geopolitics#NWO

Indian Development News 🇮🇳

@developmentnewsindia · Post #43821 · 20.04.2026 г., 02:36

UAE to Trump Administration: "You started this war; if we run short of USDs as a result of it, either you will give us USD swap lines, or we will be forced to start transacting oil and gas in CNY and other currencies." -Via Wall Street Journal #NWO#geopolitics

Indian Development News 🇮🇳

@developmentnewsindia · Post #43877 · 21.04.2026 г., 07:14

🇯🇵 Prime Minister of Japan Sanae Takaichi "Today, we amended the 'Three Principles on Transfer of Defense Equipment and Technology' and their 'Guidelines for Implementation.' Until now, the overseas transfer of domestically produced finished products had been limited to search and rescue, transportation, surveillance, mine countermeasures (so-called 'five categories'), but with this amendment, transfers of all defense equipment will in principle become possible. In an increasingly severe security environment, no single country can now protect its own peace and security alone, and partner countries that support each other in terms of defense equipment are necessary." #InternationalNews#NWO

Indian Development News 🇮🇳

@developmentnewsindia · Post #43849 · 20.04.2026 г., 11:44

The US government has called on the defense contractor V2X to evacuate its employees from Kuwait and Iraq, warning the company that they could be targeted by Iran-backed militias, four sources said. #InternationalNews#NWO https://www.theguardian.com/world/2026/apr/20/defense-contractor-evacuate-iraq-kuwait

Indian Development News 🇮🇳

@developmentnewsindia · Post #43480 · 11.04.2026 г., 20:17

🇺🇸💰💵 US Dollar now represents ~46% of global FX and gold reserves, the lowest in at least 26 years. This percentage has declined -15 points since 2017. Excluding gold, the US Dollar makes up 57% of global reserve currencies, the lowest since 1994, according to IMF data. This comes as central banks have aggressively accumulated gold and diversified into other currencies. The last time the US Dollar fell below 50% of global reserves was in 1990-1991, a period marked by elevated inflation, a recession, and a crisis of confidence in the US economy. #InternationalNews#NWO

Политическая П

@politpe · Post #19932 · 16.02.2026 г., 19:25

🌎#nwo#макро Рэй Далио на Мюнхенской конференции по безопасности: - старый мировой порядок, установленный после 1945 года уже объявлен мертвым большинством мировых лидеров - сейчас мы находимся на «6-м этапе» большого цикла, где нет правил, сила — это право, и великие державы сталкиваются друг с другом - экономические войны обычно предшествуют настоящим войнам, где стреляют - в 1930-е годы были торговые войны, технологические войны, войны капитала и геополитические войны, продолжавшиеся около десяти лет, а потом в 1939 году началась настоящая война mt в max

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