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
.spin1
=
QSpinBox(
self
)
self
.spin1.setGeometry(
100
,
100
,
150
,
40
)
self
.spin1.setPrefix("Width : ")
self
.spin1.valueChanged.connect(
self
.action_spin1)
self
.spin2
=
QSpinBox(
self
)
self
.spin2.setGeometry(
300
,
100
,
150
,
40
)
self
.spin2.setPrefix("Height : ")
self
.spin2.valueChanged.connect(
self
.action_spin2)
def
action_spin1(
self
):
current
=
self
.spin1.value()
self
.spin2.setValue(current)
def
action_spin2(
self
):
current
=
self
.spin2.value()
self
.spin1.setValue(current)
App
=
QApplication(sys.argv)
window
=
Window()
sys.exit(App.
exec
())