I’ve posted version 0.0.1 of “Orbital Motion” on the site under the Ephemeris Project tab. The GUI development is basically finished. Nothing works, but the visual framework is there.
Things started working much better after I ditched QDesigner. Although its a beautiful tool, I found that I had much more control and understanding if I built each widget manually.
Everything in Qt is based on QWidgets with each having its own class, methods, and signals (basically OOP foundations). You can see them all here. Anytime you need something, you make a copy of its class then make changes to that copy by calling its methods. Once you understand that relationship, everything else becomes really easy. I’ve prepared the following diagram and programming example in the hopes of demonstrating this:
from PyQt4.QtCore import *
from PyQt4.QtGui import *
def __init__(self, parent=None):
self.centralThingy = QWidget()
self.centralLayout = QGridLayout()
self.thingy1 = QRadioButton(“Thingy 1”)
self.thingy2 = QRadioButton(“Thingy 2”)
app = QApplication(sys.argv)
form = Main()
Step 1 – Define the Widget. A widget is a fancy name for a box to put stuff in.
Step 2 – Define the Layout. This explains how stuff appears in the box.
Step 3 – Define the Thingys. In this case, two radio buttons. But its could be anything.
Step 4 – Add the Thingys to the Layout. This tells the Layout how to show the stuff.
Step 5 – Set the Layout on the Widget. This puts the stuff in the box.
Step 6 – Set the Widget as the Central Widget. This makes the box visible.
Most PyQt classes follow this principle. The thingys could be tables, the layouts could be policies and the Central Widget could be … well just a plain old Widget, but you get the idea.