from
PyQt5.QtWidgets
import
*
from
PyQt5
import
QtCore, QtGui
from
PyQt5.QtGui
import
*
from
PyQt5.QtCore
import
*
import
sys
class
Window(QMainWindow):
def
__init__(
self
):
super
().__init__()
self
.setWindowTitle(
"Python "
)
self
.setGeometry(
100
,
100
,
600
,
400
)
self
.UiComponents()
self
.show()
def
UiComponents(
self
):
self
.spin
=
QSpinBox(
self
)
self
.spin.setGeometry(
100
,
100
,
150
,
40
)
self
.spin.setRange(
-
1
,
11
)
self
.spin.setPrefix(
"Value : "
)
self
.spin.valueChanged.connect(
self
.action_spin)
def
action_spin(
self
):
current
=
self
.spin.value()
if
current
=
=
-
1
:
self
.spin.setValue(
10
)
elif
current
=
=
11
:
self
.spin.setValue(
0
)
App
=
QApplication(sys.argv)
window
=
Window()
sys.exit(App.
exec
())