title: How to store text from QComboBox in a global variable
body: <p>I've got the following code, and after sieving through the answers on StackOverflow, I can't manage to adapt them to my (very simple) code.
  This creates a window with two drop downs (one selecting a month, and the other a year) and a button to commence the rest of the script.</p>
  
  <p>I need to store the "selection" of the Combo Box in a global variable for use in the rest of the script.</p>
  
  <p>I'm not sure if this is the most elegantly written, or even the best way to do this. </p>
  
  <p>I'm not sure if I need to encapsulate this in a class of some sort, but I've had no luck so far. The code below currently just returns the starting text, rather than user-selected text in the dropdown.</p>
  
  <pre><code>def runapp():
      def on_button_clicked():
          startprocessing()
  
      app = QApplication([])
      app.setStyle('Fusion')
      window = QWidget()
      layout = QVBoxLayout()
      combobox_month = QComboBox()
      combobox_year = QComboBox()
      progress = QLabel('Test')
      layout.addWidget(progress)
      layout.addWidget(combobox_month)
      layout.addWidget(combobox_year)
      combobox_month.addItems(calendar.month_name)
      combobox_year.addItems(['2017', '2018', '2019'])
      processbutton = QPushButton('Process')
      layout.addWidget(processbutton)
      global month
      month = str(combobox_month.currentText())
      global year
      year = str(combobox_year.currentText())
      processbutton.clicked.connect(on_button_clicked)
      window.setLayout(layout)
      window.show()
      app.exec_()
  </code></pre>