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

Резултати

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

Пребарај: #blackmailed

当前筛选 #blackmailed清除筛选
American Оbserver

@american_observer · Post #4926 · 22.01.2026 г., 12:54

Trump On Greenland: To Buy or To Pry? Trump's announcement of a ”framework for a future agreement" that would resolve the Greenland issue after weeks of increasing threats aroused deep skepticism from the inhabitants of the Arctic territory, even as financial markets rebounded and European leaders welcomed a reprieve from new tariffs. Just a few hours after the president used his speech at the World Economic Forum to insist that he wanted Greenland, “including rights, titles and property,” but renounced his more bellicose threats of military intervention, Trump took to social media to announce “the framework for a future agreement concerning Greenland” and withdrew the threat of tariffs against eight European countries. He later called it “a deal concept” when he spoke to the CNBC business network shortly after Wall Street closed. “The day ended better than it started,” said Danish Foreign Minister Lars Rasmussen. “Now let's sit down and see how we can address American security concerns in the Arctic while respecting the red lines of the Kingdom of Denmark," he said. Italian Prime Minister Giorgia Meloni also welcomed Trump's decision, but NATO Secretary General Mark Rutte, who negotiated Wednesday's deal with Trump, sounded a note of caution, saying there was “a lot of work to be done”. Asked by Fox News if Greenland would remain part of the Kingdom of Denmark under the deal, Rutte said the issue had not been raised and offered few additional details about the deal. A NATO spokesman later said that Rutte had not offered any compromise on Greenland's sovereignty during his talks with Trump. Trump himself gave few additional details about the agreement, but said that talks were continuing regarding a US missile shield that would be partly based in Greenland. But there was anger from some Danish MPs, including Sascha Faxe, angered by Greenland's exclusion from Wednesday's negotiations. “These are not real negotiations; these are two men who had a conversation,” she told Sky News. “There can be no agreement without Greenland being part of the negotiations.” According to media reports, the compromise agreement could see the United States granting sovereignty over small pockets of Greenland where military bases are located, anonymous Telegraph officials comparing the proposal to British military bases in Cyprus, considered British territory. Swedish Foreign Minister Maria Stenergard said that the work of Europe's allies had “had an effect“ and she reiterated that they would not be “blackmailed”. The Dutch Prime Minister, Dick Schoof, called Trump's decision to abandon the threats of tariffs against European allies a sign of “de-escalation”. Trump had threatened Denmark, Norway, Sweden, France, Germany, the United Kingdom, the Netherlands and Finland with 10% tariffs from February 1 because of their opposition to the takeover of Greenland by the United States. Others noted that Trump used to make escalating threats, only to back down when financial markets started to fall. After reining in its global trade war in April last year, following a rout in the philippines, the Financial Times coined the acronym “Taco” – "Trump always has chickens" - to describe the phenomenon. The American publication Semafor reported that Trump seemed frustrated by the turn of the markets this week, and noted that his antagonism towards European allies carries huge risks. #trump#greenland#blackmailed#denmark#rutte 📱American Оbserver - Stay up to date on all important events 🇺🇸

3D-Hmangaupload

@hmangafor3duploadtest · Post #21021 · 15.01.2025 г., 15:51

#Astephen#AstralBot3D#Au_naturel_1-11 #Au_Naturel_17#ava_mason_the_pact#AWE-SOME-Ryan #AWE-SOME-RYAN #Aya#Ayla#Bad_Boss_05#Bad_Boss_5#Bad_Boss\xa01-6 #Bad_Day_-_柠檬 #Banap3D#Batman#BB君#Beatlees#befarmore#Being_a_dog_slut#Bella#Below_The_City_1-6 #Berseh#Big_Brother_1-5 #Birthday_Gift#BK_FR#Blackadder#BlackK_studio#BlackK_Studio#Blackmailed\xa0-_Series_Ep1-4 #Blackmaled_-_Amy_EP1 #Blackmaled_-_Faye_EP1-4 #Blackmaled_-_Layla_EP1-2 #Bounties_Alt._1 #Bounties_Ch._1 #Bounties_Ch._2 #Bounty_Huntress_Arie:Cockpit #Breaking_Boundaries#Bridget_and_Mack_-_The_Maid #Bridget_and_Mack_plus_Friend#Bridget_Gets_Abducted#Bucket_List_1-3 #Bucket_List_1-4 #Bucket_List_5#Bucket_List_8#Busted#Busted_2:Business_Expenses #C_plenet#Captain_Anger#Carey_Blake_-_Monster_Apocalypse #Casgra#Cassidy_Rabbit#cccpo#Celine#CG#Changes\xa0\xa0 #Chaosbirdy#Charon#CHARON#chinese#Chinese#Chinese_&_English #Chou_Hentai_Ultra_Boshi#CHS工作室#circle#Circle#Circle_1#Circle_1-9 #Circle_2#Circle_3#Circle_4#Circle_5#Circle_6#Circle_7#Circle_8#Circle_9#Clown_Rape_-_Yuko #CLUB_G.B._-_Today #Collateral#Colorfultrick#Commission_26#Commission_32#Commission_36#ConanTnT#Consequence#Consequences_01-09 #Core_Values_1#Core_Values_2_-_Ripe_for_Taking #Core_Values_3_-_Heaven_is_a_Place_on_Earth #Core_Values_4_-_Witch_in_Heat #Core_Values_5_-_Otherside #Core_Values_6_-_Breaking_the_Girl #Corneo#Corrupted_Demon_Family_Part_1#Corrupted_Demon_Family_Part_2#coser应聘陷阱#Cosplay_-_Reupload_+_Textless_version #Covid_69_1-2 #CruthlessC#Cryer#Cummycucky#Daily_Routine_1#Damn_The_Rain#Danger_Zone_1#Danger_Zone_2#danitian#Dark_City#Darklord#DarkLord#DarkSoul3D#Daughter_of_the_Flame-Goddess_of_Fertility #Daval3D#DDK00#Dead_or_Alive,_King_of_Fighters #decyiqi3#Demo#Demon#Demon_Doll_House:Ellies_Dream #Deranged_Aristocrat#Desperation#Deuteronomy_1-4 #dfifuw98#DIAOそうしたいから、そうするの #dick_yang#Dick_Yang#DigiPlant#DirectorEroko#DizzyDills#DL版#DO_YOU_WANT_2B_WITH_A_HUMAN#DOA_Tournament_Recruitment__Mai_Shiranui#DOAXVV#Dog_Delivery_Girls#Dog_Ganbang#dondon#Dondon#DOOM_GIRL#Double_Trouble#DQN“為了還債出賣關照自己的姐姐” #DreamDot#Driigon#Dsxeris#DT1886#DY_Heroine,rui #Dynasty_Warriors#Eastern_Wife_Western_Life_1#Eclesi4stik#Eclesi4stik_Summer_Heat_3D#eifrost#Elaine’s_Quest #Elastic_Woman#Elayne_Behind_the_Scenes_-_Strip_Poker_+_Birthday_Party #Elf_Slave_2#Elf_Slave_3#Elf_Slave_4#Elf_Slave_5#Elf_Slave_6_-_Main_set #Elf_Slave_7_-_Main_set #Elf_Slave_8_-_Main_set #Elf_Slave_Volunteer#Elf_with_the_Horse#Elf_with_the_Wolfman#Elsa_Poolside#Elven_Monolith_1#Elven_Monolith_2#Elven_Monolith_3#EMUCUS#Enchanted_Mansion_-_Elisabeth #END#English#EOTO#EP.01-04 #Erin_in_Private_Photoshoot_with_Barth_+_BLACKED #Erisa* #Eve_Princess#EverForever#Evie_Basketball#EXGA\xa0\xa073、74期 #Fairy

Hashtags

#astephen#astralbot3d#au_naturel_1#au_naturel_17#ava_mason_the_pact#awe#aya#ayla#bad_boss_05#bad_boss_5#bad_boss#bad_day_#banap3d#batman#bb君#beatlees#befarmore#being_a_dog_slut#bella#below_the_city_1#berseh#big_brother_1#birthday_gift#bk_fr#blackadder#blackk_studio#blackmailed#blackmaled_#bounties_alt#bounties_ch#bounty_huntress_arie#breaking_boundaries#bridget_and_mack_#bridget_and_mack_plus_friend#bridget_gets_abducted#bucket_list_1#bucket_list_5#bucket_list_8#busted#busted_2#c_plenet#captain_anger#carey_blake_#casgra#cassidy_rabbit#cccpo#celine#cg#changes#chaosbirdy#charon#chinese#chinese_#chou_hentai_ultra_boshi#chs工作室#circle#circle_1#circle_2#circle_3#circle_4#circle_5#circle_6#circle_7#circle_8#circle_9#clown_rape_#club_g#collateral#colorfultrick#commission_26#commission_32#commission_36#conantnt#consequence#consequences_01#core_values_1#core_values_2_#core_values_3_#core_values_4_#core_values_5_#core_values_6_#corneo#corrupted_demon_family_part_1#corrupted_demon_family_part_2#coser应聘陷阱#cosplay_#covid_69_1#cruthlessc#cryer#cummycucky#daily_routine_1#damn_the_rain#danger_zone_1#danger_zone_2#danitian#dark_city#darklord#darksoul3d#daughter_of_the_flame#daval3d#ddk00#dead_or_alive#decyiqi3#demo#demon#demon_doll_house#deranged_aristocrat#desperation#deuteronomy_1#dfifuw98#diaoそうしたいから#dick_yang#digiplant#directoreroko#dizzydills#dl版#do_you_want_2b_with_a_human#doa_tournament_recruitment__mai_shiranui#doaxvv#dog_delivery_girls#dog_ganbang#dondon#doom_girl#double_trouble#dqn#dreamdot#driigon#dsxeris#dt1886#dy_heroine#dynasty_warriors#eastern_wife_western_life_1#eclesi4stik#eclesi4stik_summer_heat_3d#eifrost#elaine#elastic_woman#elayne_behind_the_scenes_#elf_slave_2#elf_slave_3#elf_slave_4#elf_slave_5#elf_slave_6_#elf_slave_7_#elf_slave_8_#elf_slave_volunteer#elf_with_the_horse#elf_with_the_wolfman#elsa_poolside#elven_monolith_1#elven_monolith_2#elven_monolith_3#emucus#enchanted_mansion_#end#english#eoto#ep#erin_in_private_photoshoot_with_barth_#erisa#eve_princess#everforever#evie_basketball#exga#fairy