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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
#fenetre principal:
class Bureau (QtWidgets.QWidget):
# initialisation:
def __init__(self):
super().__init__()
self.width, self.height = pyautogui.size()
self.fenetre_bureau()
self.connect_ui()
# layout principal avec ses boutons:
def fenetre_bureau(self):
self.btn_fermer= QtWidgets.QPushButton("X",self)
self.btn_fermer.move((self.width/2)-75,self.height-45)
self.btn_taff = QtWidgets.QPushButton(self)
self.btn_taff.setIcon(QtGui.QIcon(os.path.dirname(__file__)+'/image/taff.jpg'))
self.btn_taff.move(self.width - self.width/15 -10,10)
self.btn_taff.resize(self.width/15 , self.width/15)
self.btn_taff.setIconSize(QtCore.QSize(self.width/15-1,self.width/15-1))
self.btn_game = QtWidgets.QPushButton(self)
self.btn_game.setIcon(QtGui.QIcon(os.path.dirname(__file__)+'/image/taff.jpg'))
self.btn_game.move(10 , 10)
self.btn_game.resize(self.width/15 ,self.width/15)
self.btn_game.setIconSize(QtCore.QSize(self.width/15-1,self.width/15-1))
self.btn_contact = QtWidgets.QPushButton(" C",self)
self.btn_contact.move(-75,self.height-45)
# connection:
def connect_ui(self):
self.btn_fermer.clicked.connect(self.quitter)
self.btn_game.clicked.connect(self.game_icone)
# ouvre les icone game
def game_icone(self):
self.width, self.height = pyautogui.size()
self.div_width = self.width/15
self.liste_btn_placement = [(int((self.div_width + 10) * 2)),(int((self.div_width +10) *3)),(int(self.div_width * 4 + 40)),(int(self.div_width * 5 + 50))]
self.position_des_fenetre = 0
if self.position_des_fenetre == 0:
ordonnee = 10
comptage = 0
directory = os.path.dirname(__file__)+"/test_exe/**"
liste_dimage = ["hello", "blender","mouche"]
for self.game in launch_other_app.get_extern_app(directory , liste_dimage):
self.bouton_app = QtWidgets.QPushButton(self.game.app_name(),self)
#self.bouton_jeux.setIcon(QtGui.QIcon(os.path.dirname(__file__)+'/image/taff.jpg'))
coordonnee = self.liste_btn_placement[comptage]
self.bouton_app.move(coordonnee,ordonnee)
comptage += 1
self.bouton_app.resize(self.width/15 ,self.width/15)
#self.bouton_jeux.setIconSize(QtCore.QSize(self.width/15-1,self.width/15-1))
self.bouton_app.clicked.connect(self.game.launch)
self.bouton_app.show()
print(self.game)
# quitter:
def quitter(self):
exit()
app = QtWidgets.QApplication([])
ui = Bureau()
ui.setWindowFlags(QtCore.Qt.FramelessWindowHint)
ui.showMaximized()
ui.move(1, 1)
ui.show()
app.exec_() |
Partager