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

Резултати

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

Пребарај: #insidertrading

当前筛选 #insidertrading清除筛选
Trump's Ear

@trumpsear_tg · Post #2410 · 24.04.2026 г., 18:03

🇺🇸US soldier arrested for betting on Maduro’s capture — won over $400 000💰 A U.S. Army Special Forces master sergeant, Gannon Ken Van Dyke, has been arrested and charged after allegedly using classified military information to place bets on an online prediction market and win more than $400 000 based on the outcome of a covert operation that captured Venezuelan president Nicolás Maduro. Van Dyke, who was involved in Operation Absolute Resolve — the U.S. military mission that led to Maduro’s capture on January 3 — reportedly placed about 13 bets on the platform Polymarket, wagering that Maduro would be removed from power. Prosecutors say he used nonpublic knowledge of the operation to make strategic trades that paid off once the raid became public. Federal authorities have indicted him on multiple counts, including unlawful use of confidential information for personal gain, commodities fraud, wire fraud, and illegal use of classified data. Van Dyke allegedly tried to conceal his identity and the proceeds by using foreign cryptocurrency accounts and requesting deletion of his Polymarket account after the operation was announced. Officials and lawmakers have condemned the case as a serious breach of trust and a form of insider trading in prediction markets, highlighting concerns about the misuse of secret information for profit. #Military#DOJ#InsiderTrading 👂More on Trump's Ear ⚠️

Quiver Quantitative | 𝕏 You can track Cantor Fitzgerald's stock portfolio on Quiver: https://www.quiverquant.com/institutions/CANTOR%20FITZGERALD,%20L.%20P./ ~ ₿izFeed#⃣:#stockmarketdata#stockmarketnews#insidertrading

Quiver Quantitative | 𝕏 BREAKING: Cantor Fitzgerald, run by the children of Commerce Secretary Howard Lutnick, just filed a portfolio update. They bought up huge amounts of Bitcoin, Trump Media stock, and stock in the Chinese company Alibaba. Full portfolio below. ~ ₿izFeed#⃣:#stockmarketdata#stockmarketnews#insidertrading

‌Quiver Quantitative | 𝕏 BREAKING: Michael Burry, of "The Big Short" fame, just filed a portfolio update. He added: - UnitedHealth, $UNH - Lululemon, $LULU - Bruker, $BRKR - Regeneron, $REGN - MercadoLibre, $MELI Track his full portfolio on Quiver. ~ ₿izFeed#⃣:#stockmarketdata#stockmarketnews#insidertrading

‌Quiver Quantitative | 𝕏 BREAKING: Warren Buffet just filed a portfolio update. He added: - UnitedHealth, $UNH - Nucor, $NUE - Lennar, $LEN - DR Horton, $DHI - Lamar, $LAMR - Allegion, $ALLE Track his full portfolio on Quiver. ~ ₿izFeed#⃣:#stockmarketdata#stockmarketnews#insidertrading

‌Quiver Quantitative | 𝕏 BREAKING: We just received new data on Senator Dave McCormick's portfolio. He has up to $5M in Bitcoin, $IBIT. He also has to $1M in Ethereum, $ETHW. McCormick sits on the Senate Subcommittee on Digital Assets. Full portfolio up on Quiver. ~ ₿izFeed#⃣:#stockmarketdata#stockmarketnews#insidertrading

123•••56
ПретходнаСтраница 1 од 6Следна