summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Glüpker <git@wgmd.de>2016-04-06 15:31:49 +0200
committerAndré Glüpker <git@wgmd.de>2016-04-06 15:31:49 +0200
commit39d5111159203d79b97a7c6a4b2fb7d73cd543f5 (patch)
treeb7582fe0278b2faba5bb77871492a22793d53d1d
parent1a19a6e89ff1e3efe856a5184af89f96e736b38b (diff)
download9kwpyqt-39d5111159203d79b97a7c6a4b2fb7d73cd543f5.tar.gz
9kwpyqt-39d5111159203d79b97a7c6a4b2fb7d73cd543f5.tar.bz2
9kwpyqt-39d5111159203d79b97a7c6a4b2fb7d73cd543f5.zip
Add simple checkbox to disable/enable sound
-rwxr-xr-x9kwpyqt.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/9kwpyqt.py b/9kwpyqt.py
index ed796de..307a771 100755
--- a/9kwpyqt.py
+++ b/9kwpyqt.py
@@ -3,7 +3,7 @@
import sys
import time
from PyQt5.QtCore import Qt, QTimer, QUrl, pyqtSignal
-from PyQt5.QtWidgets import QApplication, QWidget
+from PyQt5.QtWidgets import QApplication, QWidget, QCheckBox
from PyQt5.QtWidgets import QLayout, QHBoxLayout, QVBoxLayout, QSizePolicy
from PyQt5.QtWidgets import QLabel, QLineEdit, QPushButton, QProgressBar
from PyQt5.QtGui import QPixmap, QImage
@@ -93,9 +93,12 @@ class CaptchaGUI(QWidget):
self.captchaInputLine = QLineEdit()
self.startstopButton = QPushButton("Start")
self.startstopButton.setCheckable(True)
+ self.soundCheckbox = QCheckBox("Sound")
+ self.soundCheckbox.setChecked(True)
self.startstopButton.clicked.connect(self.toggleRunning)
self.LayoutSettings = QHBoxLayout()
+ self.LayoutSettings.addWidget(self.soundCheckbox)
self.LayoutSettings.addWidget(self.startstopButton)
self.LayoutSubmit = QVBoxLayout()
@@ -165,7 +168,8 @@ class CaptchaGUI(QWidget):
if result:
self.captchaImage.setImage(pixmap)
self.captchaInputLine.setFocus()
- self.sound.play()
+ if self.soundCheckbox.isChecked():
+ self.sound.play()
self.timer.start(30000)
self.captchaImage.setText("")
else: