当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
[k210 stepping pit] pytorch model is converted to kmodel and used on dock. (ultimately not achieved)
Labelme cannot open the picture
mpc5744p简介与OpenSDA固件更新
Definition and implementation of stack and queue (detailed)
Locker 2022.1.1
Object detection: object_ Detection API +ssd target detection model
Machine vision Series 2: vs DLL debugging
Use of torch.optim optimizer in pytorch
Deploy Jenkins using containers
Openfeign asynchronous call problem
用 ZEGO Avatar 做一个虚拟人|虚拟主播直播解决方案
C语言:typedef知识点总结
不会就坚持59天吧 替换单词
Unity基础(3)—— unity中的各种坐标系
Exception resolution: error of not finding edu.stanford.nlp.semgraph.semgrex.semgrexpattern in cococaption package
C language: talking about various complex statements
Not for 61 days. The shortest word code
C language force buckle question 61 of the rotating list. Double ended queue and construction of circular linked list
11. Backup switch
Idea small settings









