May 2019
Intermediate to advanced
542 pages
13h 37m
English
To get a sense of the 3D aspects of our drawing, we're going to build some controls into our GUI that allow us to rotate and zoom around the drawing.
We'll start by adding some buttons in MainWindow.__init__() that we can use as controls:
btn_layout = qtw.QHBoxLayout() main.layout().addLayout(btn_layout) for direction in ('none', 'left', 'right', 'up', 'down'): button = qtw.QPushButton( direction, autoExclusive=True, checkable=True, clicked=getattr(oglw, f'spin_{direction}')) btn_layout.addWidget(button) zoom_layout = qtw.QHBoxLayout() main.layout().addLayout(zoom_layout) zoom_in = qtw.QPushButton('zoom in', clicked=oglw.zoom_in) zoom_layout.addWidget(zoom_in) zoom_out = qtw.QPushButton('zoom out', ...Read now
Unlock full access