当前位置:网站首页>Pyqt5 learning pit encounter and pit drainage (3) background picture coverage button style and check button status
Pyqt5 learning pit encounter and pit drainage (3) background picture coverage button style and check button status
2022-07-29 04:29:00 【Lishizhen land】
I used it all afternoon today designer, It 's a long story , There is a button problem 3 Hours .
One 、 How to modify the style when a button is clicked
problem : Try to use at first btn.ischecked() and btn.isdown(), It didn't work . Later, I thought of using signals , Still fruitless , In despair , He showed up :btn.pressed(),btn.released()
The code is as follows :
self.pushButton_god.pressed.connect(self.change1)
self.pushButton_god.released.connect(self.recovery1)
First act pressed The signal , It means to send a signal when the button is pressed
Second behavior released The signal , Indicates that a signal is emitted when the mouse is released
Two 、 Adding a background image to the window overrides the button style
problem : As shown above ;
terms of settlement : Set up style style .
# Set for window name
MainWindow.setObjectName("MainWindow")
# Set up QSS style
myWin.setStyleSheet("#MainWindow {background-image:url(../img/map.jpg)}")
When we are right MainWindow When setting styles , Does not change the style of other controls .
#MainWindow As the key point
边栏推荐
- 不会就坚持61天吧 最短的单词编码
- 恒星科通邀您“湘”约第24届中国高速公路信息化大会暨技术产品展示会
- 用 ZEGO Avatar 做一个虚拟人|虚拟主播直播解决方案
- Cad2020 introductory learning (2021.4.13)
- Kotlin's list, map, set and other collection classes do not specify types
- Hengxing Ketong invites you to the 24th China expressway informatization conference and technical product exhibition in Hunan
- Installation and use of stm32cubemx (5.3.0)
- post导出数据,返回
- Model tuning, training model trick
- 使用容器部署Jenkins
猜你喜欢

顺序表和链表

Won't you just stick to 62 days? Sum of words

不会就坚持65天吧 只出现一次的数字

LeetCode_ Stack topics

Installation and use of stm32cubemx (5.3.0)

不会就坚持62天吧 单词之和

The principle of inverse Fourier transform (IFFT) in signal processing

HC06 HC05 BT

Webrtc realizes simple audio and video call function

Implementation of jump connection of RESNET (pytorch)
随机推荐
用 ZEGO Avatar 做一个虚拟人|虚拟主播直播解决方案
SQL time fuzzy query datediff() function
Multi card training in pytorch
Understand the Internet giant [the war between China and Taiwan] and the development thinking of China and Taiwan
不会就坚持68天吧 狒狒吃香蕉
Webrtc realizes simple audio and video call function
读懂 互联网巨头 【中台之战】 以及 中台 发展思维
Pytorch fixed random seed & recurrence model
No, just stick to it for 59 days
你真的会写Restful API吗?
Not for 58 days. Implement prefix tree
Not for 60 days, magical dictionary
MySQL - 聚簇索引和辅助索引
[material delivery UAV] record (ROS + Px4 + yolov5 + esp8266 + steering gear)
Pyscript cannot import package
Can you really write restful API?
12.优先级队列和惰性队列
Actual combat of flutter - DIO of request encapsulation (II)
JVM (heap and stack) memory allocation
不会就坚持66天吧 权重生成随机数