Updating PyQT



  • Hello. There's a program written on Python 3, using QT 5. There are several comboboxes that change the other part of the window.

    The first compbox shall remove the date chosen by the user, for example:

    Combobox_1

    • Yesterday.
    • Today.
    • Tomorrow.

    The second counts the results of the first few days and takes the second line:

    Combobox_2

    • combobox_1 + 1 day
    • combobox_1 + 2 days
    • combobox_1 + 3 days

    It's working. If I set up, for example 08.11.16, then chose +1 days, that is, the second label will be 09.11.16, and then the first combobox changed 07.11.16, the second combobox won't change, it's still 9.11.16. How do we get combobox's updated?



  • to combo1 put currentIndexChanged, which will change combo2.setCurrentIndex

    def set_combo2():
        text = self.combo1.currentText()
        index = date_list.index(text)
        self.combo2.setCurrentIndex(index)
    

    self.combo1.currentIndexChanged.connect(set_combo2)




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2