TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #381 · 23 окт.

Установить свойства виджета в PySide можно не только через соответствующие методы и конструктор класса. Можно их изменять с помощью метода setProperty по имени. btn = QPushButton("Click Me") btn.setProperty("flat", True) Это аналогично вызову btn.setFlat(True) Если указать несуществующее свойство, то оно просто создается btn.setProperty("btnType", "super") Получить его значение можно методом .property(name) btn_type = btn.property("btnType") Когда это может быть полезно? ▫️Можно просто хранить какие то данные в виджете и потом их доставать обратно widget = QWidget() widget.setProperty('my_data', 123) print(widget.property('my_data')) ▫️ Назначая эти свойства разным виджетам можно потом отличить виджеты во время итераци по ним. Например, найти все кнопки со свойством my_data="superbtn". Но ведь вместо кастомного свойства можно использовать objectName, будет тот же результат. Да, но y ObjectName есть ограничение - только строки. ▫️ Если нам потребуется не просто поиск а, например, сортировка по числу, то свойства позволяют нам это сделать. Поддерживается любой тип данных widget.setProperty('my_data', {'Key': 'value'}) widget.setProperty('order', 1) all_widgets.sort(key=w: w.property('order')) Но ведь Python позволяет всё вышеперечисленное сделать простым созданием атрибута у объекта widget.order = 1 widget.my_data = 123 Да, но я думаю что не надо объяснять почему не стоит так делать. К тому же, если у виджета нет свойства то метод .property(name) вернет None, а отсутствующий атрибут выбросит исключение. ▫️ Действительно полезное применение кастомным свойствам - контроль стилей. Здесь атрибутами не обойтись, нужны именно свойства. Дело в том, что в селекторах стилей можно указывать конкретные свойства виджетов на которые следует назначать стиль. Просто запустите этот код from PySide2.QtWidgets import * if __name__ == "__main__": app = QApplication([]) widget = QWidget(minimumWidth=300) layout = QVBoxLayout(widget) btn1 = QPushButton("Action 1") btn2 = QPushButton("Action 2") btn3 = QPushButton("Action 3", flat=True) layout.addWidget(btn1) layout.addWidget(btn2) layout.addWidget(btn3) # добавим кастомное свойство одной кнопке btn1.setProperty("btnType", "super") # добавляем стили widget.setStyleSheet( """ QPushButton[btnType="super"] { background-color: yellow; color: red; } QPushButton[flat="true"] { color: yellow; } """ ) widget.show() app.exec_() С помощью селектора мы избирательно назначили стили на конкретные кнопки. Как получить список всех кастомный свойств? Функция получения списка кастомных свойств отличается от получения дефолтных. def print_widget_dyn_properties(widget): for prop_name in widget.dynamicPropertyNames(): property_name = prop_name.data().decode() property_value = widget.property(property_name) print(f"{property_name}: {property_value}") #tricks#qt

Hashtags

Резултати

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

Пребарај: #fergana

当前筛选 #fergana清除筛选
EKOLOG.UZ| ENG

@ekologuzenglish · Post #11807 · 06.03.2026 г., 05:05

#Fergana 📢 Cases of illegal extraction and sale of fertile soil are increasing in the Fergana Valley! In the Rishton district of Fergana region (Chek Jalaer MFY) and in the riverbank areas of Bog‘dod district, a serious ecological problem has been observed. According to local residents, fertile soil layers have been dug up and sold in these areas for a long time. What is particularly concerning is that these activities are happening even within the 13-meter protection zone of water-melioration areas. In some locations, soil has been excavated to depths of 9–10 meters. This can lead to: — a sharp decrease in soil fertility, — loss of agricultural lands, — damage to irrigation and water systems, — potential landslides and disruption of ecological balance in the future. ❗️ The question arises: Who is monitoring these activities? This issue requires attention from: Fergana Regional Ecology Department, Land Resources and Cadastre Service, Water Management Organizations, and local hokimiyats. Fertile soil is a natural resource formed over centuries. Destroying it for short-term gain is not only a legal violation but also a responsibility toward future generations. 🌱 ☘️Read the latest environmental news on the @ekologuz page. Follow us and send your suggestions and wishes via @eklguz_bot Instagram | Facebook | Twitter | Sayt | Youtube.

Hashtags

Sherzod Mirzajahonovich

@sherzod_axmatov · Post #381 · 26.02.2022 г., 10:24

✅ Farg‘ona viloyati Raqamli texnologiyalar markazida mGovAward tanlovi bo‘yicha seminar bo‘lib o‘tdi 📺 Shu haqda “Yoshlar” telekanali tomonidan maxsus lavha tayyorlanib, efirga uzatildi. 🔹🔹🔹 ✅ В Учебном центре цифровых технологий в Ферганской области прошел учебный семинар в рамках конкурса mGovAward. 📺 Об этом на телеканале «Yoshlar» подготовил специальный репортаж. #mitc #mgovaward #fergana📌 Telegram|Twitter|Facebook|Instagram|Youtube

Sherzod Mirzajahonovich

@sherzod_axmatov · Post #378 · 26.02.2022 г., 10:19

✅ Farg‘ona viloyati Raqamli texnologiyalar markazida mGovAward tanlovi bo‘yicha seminar bo‘lib o‘tdi Batafsil: 👉https://mitc.uz/uz/news/view/3688 🔹🔹🔹 ✅ В Учебном центре цифровых технологий в Ферганской области прошел учебный семинар в рамках конкурса mGovAward Подробно: 👉https://mitc.uz/ru/news/view/3688 #mitc #mgovaward #fergana 📌 Telegram|Twitter|Facebook|Instagram|Youtube

Bahrom Djalilov | Blog

@bahromjon_djalilov · Post #49 · 07.08.2024 г., 06:14

❇️Grafik dizayner 💵 Maosh: Tajribaga qarab (1000$) Ish turi: Ofis ishi Manzil: Farg'ona Kompaniya: WeaYaa - GameDev kompaniyasi - Ish haqida ma‘lumot: Koreya o'yin kompaniyasi O'zbekistonda o'z filialini ochilmoqda. Ushbu kompaniyaga o'yin uchun dizayn ishlab chiquvchi dizaynerlar kerak; - Ish tajribasi: sketching, o'yin personajlari yaratish va grafik planshetda chizish qobiliyati; - Photoshop, illustrator yoki sketching dasturlarida ishlash talab etiladi 📨 Aloqa: @creatornsl #grafikdizayner#dizayn#fergana —————————— 👉@freelanceteam_uz

Сайёд Баротов

@sayyodbarotov · Post #26 · 23.07.2023 г., 05:03

Люди в Фергане Второй раз я оказываюсь в этом восхитительном городе и каждый раз нахожу что-то новое. Самым прекрасным открытием для меня здесь стали люди: их непревзойденная вежливость и доброта просто поражают. С самого начала, с первых встреч, вы почувствуете это. Скорее всего, первыми людьми, с которыми вы столкнетесь, будут таксисты. Как будто мне всегда выпадает тариф «бизнес»)) Но это отнюдь не исключительность профессии: любой прохожий на улице готов оказать помощь, и делает он это с теплом и душевностью. Важно отметить, что местные жители общаются друг с другом на «Вы», что становится подтверждением их уважительного отношения и особого менталитета. В общем, это место я просто обожаю! #Fergana#Uzbekistan#travel

EKOLOG.UZ| ENG

@ekologuzenglish · Post #11771 · 02.03.2026 г., 11:01

#Fergana🚨 Measures taken against cockfight organizers in Qushtеpa district, Fergana region! Individuals who regularly organized fights involving roosters, dogs, and quails were identified and held accountable. Such fights are considered gambling and constitute cruelty to animals. While some may see this as ordinary or even amusing, such “gambling venues” are extremely dangerous for society. It was revealed that not only adults but also children participated. If a child bets on animal suffering from a young age, what can be expected when they grow up? ⚖️ Reminder: rooster, quail, and dog fights are classified as gambling. In this case, the organizers in Qushtеpa district, Fergana region, were held accountable under Article 191 of the Code of Administrative Responsibility — “Illegal participation in other games based on gambling and risk.” #Fergana#Qushtеpa#AnimalProtection#Gambling#NoCruelty ☘️Read the latest environmental news on the @ekologuz page. Follow us and send your suggestions and wishes via @eklguz_bot Instagram | Facebook | Twitter | Sayt | Youtube.

EKOLOG.UZ| ENG

@ekologuzenglish · Post #10556 · 29.11.2025 г., 08:02

Fergana Region, Fergana District, Mindonobod Neighborhood: We can’t breathe, please help! Our homes are located near an asphalt plant, and due to its operations, dust and emissions enter our homes every day. If you step outside around 5–6 a.m., you can see the air is covered in haze. This situation seriously affects the health of our children: allergies and respiratory problems are increasing. We have repeatedly submitted complaints through the clinic, neighbors, and other organizations, and sent letters to higher authorities, but no measures have been taken. The environmental agency has also failed to address the problem. In addition, next to the asphalt plant, there are Megamix and Alibaster production facilities, whose emissions further worsen the air quality. We are calling on the public and responsible authorities: please pay attention to this air pollution and the threat it poses to our children’s health, and take the necessary measures! #Fergana#Mindonobod#Environment#AirPollution#ChildHealth#AsphaltPlant ☘️ Follow the latest environmental news on @ekologuz. Send your suggestions and feedback via @eklguz_bot.