From 39d5111159203d79b97a7c6a4b2fb7d73cd543f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Gl=C3=BCpker?= Date: Wed, 6 Apr 2016 15:31:49 +0200 Subject: Add simple checkbox to disable/enable sound --- 9kwpyqt.py | 8 ++++++-- 1 file 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: -- cgit v1.2.3