title: How to save selected element from combobox as variable in PyQt5?
body: <p>I'm interested in how to save a selected value from my combobox as variable, so when I press e.g. B then I want it to be saved as SelectedValueCBox = selected value, which would be B in this case.
  Thank you for your help</p>
  <pre><code>from PyQt5.QtCore import *
  from PyQt5.QtWidgets import *
  import sys
  
  class App(QMainWindow): 
      def __init__(self): 
          super().__init__() 
          self.title = &quot;PyQt5 - StockWindow&quot;
          self.left = 0
          self.top = 0
          self.width = 200
          self.height = 300
          self.setWindowTitle(self.title) 
          self.setGeometry(self.left, self.top, self.width, self.height) 
          self.tab_widget = MyTabWidget(self) 
          self.setCentralWidget(self.tab_widget) 
          self.show() 
  
  class MyTabWidget(QWidget): 
      def __init__(self, parent): 
          super(QWidget, self).__init__(parent) 
          self.layout = QVBoxLayout(self)
          #self.layout = QGridLayout(self) 
          self.tabs = QTabWidget() 
          self.tab1 = QWidget() 
          self.tabs.resize(300, 200) 
          self.tabs.addTab(self.tab1, &quot;Stock-Picker&quot;) 
          self.tab1.layout = QGridLayout(self)
  
          button = QToolButton()
          self.tab1.layout.addWidget(button, 1,1,1,1)
  
          d = {'AEX':['A','B','C'], 'ATX':['D','E','F'], 'BEL20':['G','H','I'], 'BIST100':['J','K','L']}
  
          def callback_factory(k, v):
             return lambda: button.setText('{0}_{1}'.format(k, v))
  
          menu = QMenu()
          self.tab1.layout.addWidget(menu, 1,1,1,1)
          for k, vals in d.items():
              sub_menu = menu.addMenu(k)
              for v in vals:
                  action = sub_menu.addAction(str(v))
                  action.triggered.connect(callback_factory(k, v))
              button.setMenu(menu)
        
          self.tab1.setLayout(self.tab1.layout)
          self.layout.addWidget(self.tabs)
          self.setLayout(self.layout)
  if __name__ == '__main__':
      app = QApplication(sys.argv)
      ex = App()
      sys.exit(app.exec_())
  </code></pre>