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

Резултати

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

Пребарај: #scams

当前筛选 #scams清除筛选
TONlines – News

@tonlines · Post #6986 · 30.04.2025 г., 14:21

Tonnel Network: Caution with B-Day Candle Purchases #Tonnel#scams The Tonnel Network warns users about scams involving the purchase of B-Day Candles. It is advised to only buy candles that are mintable, indicated by a blue glow. Source: link @tonlines

News and Tips

@NewsAndTipsNT · Post #3508 · 24.07.2025 г., 15:46

⚠️Dear subscribers, Please don’t fall for cheap tricks. There's been a rise in NFT-related #scams on Telegram lately. If anyone messages you asking to connect certain apps, don’t fall for it , it’s clearly a scam. Never connect your wallet to unknown sources just for the sake of giveaways or so-called "free" #gifts. Remember, nothing is truly free. Also, some channels are using unhealthy giveaway methods to collect user data or trick people into spending money. Think carefully before participating — if you're not comfortable with it, don't spend your money. Here are some safe ways to buy and sell Telegram #NFTs: 1. Buy directly from Telegram: Go to ⚙Settings > 🎁 Buy a Gift. Drops appear randomly, check often and buy when available. You can later upgrade them to NFTs when the option is available. 2. Use Telegram’s built-in buy/sell option: You can trade NFTs securely within the app. ⚙Settings : 🎁Buy a gift : Resale 3. Visit Fragment: A trusted and official platform for buying and selling Telegram collectibles. 4. Use third-party platforms like @Portals/@Tonnel_Network_bot : Reputable web apps can also be used, but make sure they are trustworthy and secure. Stay smart and stay safe!🤝

Venture Village Wall 🦄

@venturevillagewall · Post #4296 · 03.03.2025 г., 16:00

Crypto Fundraising Soars 93.5% in 2024 In 2024, crypto and blockchain startups raised $15.4B, marking a 93.5% increase from 2023. Closed funding rounds reached 1,597, a 45% jump. Early rounds make up 36% of deals. Top VCs include Animoca Brands, OKX Ventures, and MH Ventures. Bitcoin Update: Despite a drop in February, Bitcoin surged 9.3% in March. Currently priced at approximately $91,000. SEC News: SEC drops lawsuit against Kraken, reducing regulatory pressures on the market. US Senate set to vote on IRS rule affecting crypto & DeFi. Scam Alert: Nine residents in Kent, UK lost £1.2M to scammers using personal data to impersonate police. For detailed insights, visit: Alef Aeronautics | Bitcoin Price Update | SEC Lawsuit Info #Crypto#VC#Bitcoin#SEC#Regulation#Tether#USDC#Investments#EarlyStage#Scams#Blockchain#Funding

Venture Village Wall 🦄

@venturevillagewall · Post #3852 · 12.01.2025 г., 01:00

Investigation Reveals Unusual Money Practices An investigation by Rekt News uncovers hardcoded lies and collapsing pegs in the crypto market, with implications that a founder may be manipulating the situation from both sides. Full details in the report: Rekt News #Crypto#Investigation#Finance#MarketTrends#RektNews#LeviathanNews#Blockchain#DeFi#Web3#Trading#Scams

Venture Village Wall 🦄

@venturevillagewall · Post #3894 · 16.01.2025 г., 16:00

Burwick Law Suing Pump.fun Over Losses ⚖️ Burwick Law to file suit against Pump.fun on behalf of investors who lost significant sums in meme coin platform. Legal experts criticize the dominance of scams and speculative assets in crypto. 📊 6.1M tokens launched with total raised nearing $2.3M. More details here. #Crypto#Law#PumpFun#Investors#MemeCoins#Scams#Investments#Litigation#Finance#BurwickLaw

Venture Village Wall 🦄

@venturevillagewall · Post #3938 · 21.01.2025 г., 13:00

Massive USDC Minting and Meme Coin Scam 🚨 50M USDC minted at USDC Treasury, totaling $50.05M. Meanwhile, investors are falling victim to a scam involving fake Trump-related meme coins. Beware of various tokens like BARRON and IVANKA that are misleadingly launched under false pretenses, all funnelling funds to a scam wallet. ⚠️ Over 600 such tokens already spotted! More details here. AI funding news: - Qventus: $85M for AI healthcare ops. - Prophecy.io: $47M for data pipeline solutions. - Gesynta Pharma: $27.27M for new drugs. - Leap Services: $20M for omnichannel retail platform. - NeuroBionics: $5M for advancing neurotech. - Atlantic Sea Farms: $3.80M for sustainable seaweed farming. Find more funding details in the summary! #USDC#Crypto#AI#Funding#MemeCoins#Scams#Healthcare#Data#Pharma#Retail#Neurotech#Seafood#Tech#Investments#Investing#Finance#Blockchain