-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.py
49 lines (35 loc) · 1.37 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from PySide6 import QtWidgets
from PySide6.QtCore import QEvent
from ui_main import Ui_MainWindow
import random
class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
def __init__(self):
super(MainWindow, self).__init__()
self.setupUi(self)
self.coracao.setVisible(False)
self.botao_nao.clicked.connect(self.moveButton)
self.botao_sim.clicked.connect(self.bestOption)
self.frame_nao.installEventFilter(self)
self.frame_sim.installEventFilter(self)
def moveButton(self):
self.frame_nao.move(random.randint(0, 300), random.randint(0, 300))
def bestOption(self):
self.querNamorarCmg.setText("Você escolheu a melhor opção!!!")
self.querNamorarCmg.setStyleSheet("QLabel{\n"
" font-size: 25px;\n"
" font-weight: bold;\n"
" color: rgb(255, 255, 255);\n"
"}\n")
self.botao_sim.setVisible(False)
self.botao_nao.setVisible(False)
self.coracao.setVisible(True)
def eventFilter(self, obj, event):
if event.type() == QEvent.Enter and obj == self.frame_nao:
self.moveButton()
return True
else:
return False
app = QtWidgets.QApplication([])
window = MainWindow()
window.show()
app.exec()