title: Linking PyQt output with python file
body: <p>How do I link this PyQt output with the python file at the bottom?I looked at various tutorials but I can not figure it out. How do I set values to the radio buttons so if someone clicks earth r is filled in with 6.4*10**6 and g is set to 9.8?</p>
  <h2>from Qt designer</h2>
  <pre><code>import sys
  from PyQt4 import QtCore, QtGui
  from projectile_ui import Ui_Form
  
  
  class MyForm(QtGui.QMainWindow):
      def __init__(self, parent=None):
          QtGui.QWidget.__init__(self, parent)
          self.ui = Ui_Form()
          self.ui.setupUi(self)
  
  try:
      _fromUtf8 = QtCore.QString.fromUtf8
  except AttributeError:
      _fromUtf8 = lambda s: s
  
  class Ui_Form(object):
      def setupUi(self, Form):
          Form.setObjectName(_fromUtf8(&quot;Form&quot;))
          Form.resize(443, 340)
          self.Tilte = QtGui.QLabel(Form)
          self.Tilte.setGeometry(QtCore.QRect(130, 10, 131, 16))
          self.Tilte.setObjectName(_fromUtf8(&quot;Tilte&quot;))
          self.Vo = QtGui.QDoubleSpinBox(Form)
          self.Vo.setGeometry(QtCore.QRect(20, 40, 81, 22))
          self.Vo.setMaximum(999999999.0)
          self.Vo.setObjectName(_fromUtf8(&quot;Vo&quot;))
          self.angle = QtGui.QDoubleSpinBox(Form)
          self.angle.setGeometry(QtCore.QRect(20, 70, 81, 22))
          self.angle.setMaximum(90.0)
          self.angle.setObjectName(_fromUtf8(&quot;angle&quot;))
          self.dt = QtGui.QDoubleSpinBox(Form)
          self.dt.setGeometry(QtCore.QRect(20, 100, 81, 22))
          self.dt.setDecimals(3)
          self.dt.setMinimum(0.0)
          self.dt.setMaximum(1.0)
          self.dt.setSingleStep(0.001)
          self.dt.setProperty(&quot;value&quot;, 0.01)
          self.dt.setObjectName(_fromUtf8(&quot;dt&quot;))
          self.Jupiter = QtGui.QRadioButton(Form)
          self.Jupiter.setGeometry(QtCore.QRect(20, 240, 82, 17))
          self.Jupiter.setObjectName(_fromUtf8(&quot;Jupiter&quot;))
          self.Saturn = QtGui.QRadioButton(Form)
          self.Saturn.setGeometry(QtCore.QRect(20, 260, 82, 17))
          self.Saturn.setObjectName(_fromUtf8(&quot;Saturn&quot;))
          self.Sun = QtGui.QRadioButton(Form)
          self.Sun.setGeometry(QtCore.QRect(20, 140, 82, 17))
          self.Sun.setCheckable(True)
          self.Sun.setObjectName(_fromUtf8(&quot;Sun&quot;))
          self.Venus = QtGui.QRadioButton(Form)
          self.Venus.setGeometry(QtCore.QRect(20, 180, 82, 17))
          self.Venus.setObjectName(_fromUtf8(&quot;Venus&quot;))
          self.Mars = QtGui.QRadioButton(Form)
          self.Mars.setGeometry(QtCore.QRect(20, 220, 82, 17))
          self.Mars.setObjectName(_fromUtf8(&quot;Mars&quot;))
          self.Neptune = QtGui.QRadioButton(Form)
          self.Neptune.setGeometry(QtCore.QRect(20, 300, 82, 17))
          self.Neptune.setObjectName(_fromUtf8(&quot;Neptune&quot;))
          self.Earth = QtGui.QRadioButton(Form)
          self.Earth.setGeometry(QtCore.QRect(20, 200, 82, 17))
          self.Earth.setObjectName(_fromUtf8(&quot;Earth&quot;))
          self.Uranus = QtGui.QRadioButton(Form)
          self.Uranus.setGeometry(QtCore.QRect(20, 280, 82, 17))
          self.Uranus.setObjectName(_fromUtf8(&quot;Uranus&quot;))
          self.Mercury = QtGui.QRadioButton(Form)
          self.Mercury.setGeometry(QtCore.QRect(20, 160, 82, 17))
          self.Mercury.setObjectName(_fromUtf8(&quot;Mercury&quot;))
          self.Vo_Label = QtGui.QLabel(Form)
          self.Vo_Label.setGeometry(QtCore.QRect(110, 40, 71, 21))
          self.Vo_Label.setObjectName(_fromUtf8(&quot;Vo_Label&quot;))
          self.Angle_Label = QtGui.QLabel(Form)
          self.Angle_Label.setGeometry(QtCore.QRect(110, 70, 61, 21))
          self.Angle_Label.setObjectName(_fromUtf8(&quot;Angle_Label&quot;))
          self.dt_Label = QtGui.QLabel(Form)
          self.dt_Label.setGeometry(QtCore.QRect(110, 100, 61, 21))
          self.dt_Label.setObjectName(_fromUtf8(&quot;dt_Label&quot;))
          self.LCDheight = QtGui.QLCDNumber(Form)
          self.LCDheight.setGeometry(QtCore.QRect(230, 150, 181, 71))
          self.LCDheight.setObjectName(_fromUtf8(&quot;LCDheight&quot;))
          self.lcdTotaltime = QtGui.QLCDNumber(Form)
          self.lcdTotaltime.setGeometry(QtCore.QRect(230, 250, 181, 71))
          self.lcdTotaltime.setObjectName(_fromUtf8(&quot;lcdTotaltime&quot;))
          self.label = QtGui.QLabel(Form)
          self.label.setGeometry(QtCore.QRect(230, 132, 181, 21))
          self.label.setObjectName(_fromUtf8(&quot;label&quot;))
          self.label_2 = QtGui.QLabel(Form)
          self.label_2.setGeometry(QtCore.QRect(230, 232, 181, 21))
          self.label_2.setObjectName(_fromUtf8(&quot;label_2&quot;))
          self.pushButton = QtGui.QPushButton(Form)
          self.pushButton.setGeometry(QtCore.QRect(230, 50, 181, 61))
          self.pushButton.setAutoFillBackground(False)
          self.pushButton.setDefault(False)
          self.pushButton.setFlat(False)
          self.pushButton.setObjectName(_fromUtf8(&quot;pushButton&quot;))
  
          self.retranslateUi(Form)
          QtCore.QMetaObject.connectSlotsByName(Form)
  
      def retranslateUi(self, Form):
          Form.setWindowTitle(QtGui.QApplication.translate(&quot;Form&quot;, &quot;Form&quot;, None, QtGui.QApplication.UnicodeUTF8))
          self.Tilte.setText(QtGui.QApplication.translate(&quot;Form&quot;, &quot;Projectile Motion Calculator&quot;, None, QtGui.QApplication.UnicodeUTF8))
          self.Jupiter.setText(QtGui.QApplication.translate(&quot;Form&quot;, &quot;Jupiter&quot;, None, QtGui.QApplication.UnicodeUTF8))
          self.Saturn.setText(QtGui.QApplication.translate(&quot;Form&quot;, &quot;Saturn&quot;, None, QtGui.QApplication.UnicodeUTF8))
          self.Sun.setText(QtGui.QApplication.translate(&quot;Form&quot;, &quot;Sun &quot;, None, QtGui.QApplication.UnicodeUTF8))
          self.Venus.setText(QtGui.QApplication.translate(&quot;Form&quot;, &quot;Venus&quot;, None, QtGui.QApplication.UnicodeUTF8))
          self.Mars.setText(QtGui.QApplication.translate(&quot;Form&quot;, &quot;Mars&quot;, None, QtGui.QApplication.UnicodeUTF8))
          self.Neptune.setText(QtGui.QApplication.translate(&quot;Form&quot;, &quot;Neptune&quot;, None, QtGui.QApplication.UnicodeUTF8))
          self.Earth.setText(QtGui.QApplication.translate(&quot;Form&quot;, &quot;Earth&quot;, None, QtGui.QApplication.UnicodeUTF8))
          self.Uranus.setText(QtGui.QApplication.translate(&quot;Form&quot;, &quot;Uranus&quot;, None, QtGui.QApplication.UnicodeUTF8))
          self.Mercury.setText(QtGui.QApplication.translate(&quot;Form&quot;, &quot;Mercury&quot;, None, QtGui.QApplication.UnicodeUTF8))
          self.Vo_Label.setText(QtGui.QApplication.translate(&quot;Form&quot;, &quot;Initial Velocity &quot;, None, QtGui.QApplication.UnicodeUTF8))
          self.Angle_Label.setText(QtGui.QApplication.translate(&quot;Form&quot;, &quot;Angle&quot;, None, QtGui.QApplication.UnicodeUTF8))
          self.dt_Label.setToolTip(QtGui.QApplication.translate(&quot;Form&quot;, &quot;&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Smaller number gives more accurate results.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;&quot;, None, QtGui.QApplication.UnicodeUTF8))
          self.dt_Label.setText(QtGui.QApplication.translate(&quot;Form&quot;, &quot;Time Step&quot;, None, QtGui.QApplication.UnicodeUTF8))
          self.label.setText(QtGui.QApplication.translate(&quot;Form&quot;, &quot;Max Height &quot;, None, QtGui.QApplication.UnicodeUTF8))
          self.label_2.setText(QtGui.QApplication.translate(&quot;Form&quot;, &quot;Total Time &quot;, None, QtGui.QApplication.UnicodeUTF8))
          self.pushButton.setText(QtGui.QApplication.translate(&quot;Form&quot;, &quot;Calculate&quot;, None, QtGui.QApplication.UnicodeUTF8))
  
  if __name__ == &quot;__main__&quot;:
      app = QtGui.QApplication(sys.argv)
      myapp = MyForm()
      myapp.show()
      sys.exit(app.exec_())
  </code></pre>
  <h2>Code I want to link to the UI.</h2>
  <pre><code>from math import*
  def main():
      loopiterations = int()
  
      dt = eval(input(&quot;&quot;)) ##time step
  
      Vo = eval(input(&quot;&quot;))
      xo = 0
      yo = 0
      angle = eval(input(&quot;&quot;))
      angle = angle * (pi / 180)
      Vox = Vo * cos(angle)
      Voy = Vo * sin(angle)
      y =  (yo + Voy * dt)
      r=eval(input(&quot;&quot;))  ## r= 6.4*10**6 for earth 
      g = eval(input(&quot;&quot;))  ## m/s **2
      Vy=Voy - g * dt
      iterations = 0
  
      while not (Vy &lt; 0):
          y =  (yo + Voy * dt)
          Vy= (Voy - g * dt)
          x = (xo + Vox * dt)
          Vx = Vox
          iterations = iterations + 1
          yo = y
          xo = x
          Vox = Vx
          Voy = Vy
      print (y)
      print(iterations)
  </code></pre>