forked from ttbilgin/PyNar_Dokumantasyon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
errortest.py
28 lines (23 loc) · 995 Bytes
/
errortest.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
import sys
from PyQt5 import QtCore, QtWidgets
from PyQt5.QtWidgets import QMainWindow, QLabel, QGridLayout, QWidget
from PyQt5.QtWidgets import QPushButton
from PyQt5.QtCore import QSize
from playsound import playsound # ses için
class MainWindow(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
self.setMinimumSize(QSize(300, 200))
self.setWindowTitle("PyQt button example - pythonprogramminglanguage.com")
pybutton = QPushButton('Click me', self)
pybutton.clicked.connect(self.clickMethod)
pybutton.resize(100,32)
pybutton.move(50, 50)
def clickMethod(self):
playsound('error.mp3',False)#async çalması için False yaptık.Fakat linuxta ikinci parametre çalışmıyor.Manuel olarak async yapmak gerekir.
print('Clicked Pyqt button.')
if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
mainWin = MainWindow()
mainWin.show()
sys.exit( app.exec_() )