I loaded and created the GUI using .ui or uic module.
Example of my tool's code:
class MyWindow(QtGui.QWidget):
def __init__(self):
...
# self.informationVisBtn, `setChecked` and `setCheckable` field is checked in the .ui file
self.informationVisBtn.toggled.connect(self.setInfoVis)
def setInfoVis(self):
self.toggleVisibility(
self.informationVisBtn.isChecked()
)
def toggleVisibility(self, value):
if value:
self.uiInformationFrame.show()
self.informationVisBtn.setText("-")
else:
self.uiInformationFrame.hide()
self.informationVisBtn.setText("+")
As I load my tool, I had expected the button text to be '-' but instead it shows up as '+', even though the frame is still shown.
I had thought that by using toggled and having it initialized under the __init__(), it will reads both setInfoVis() and toggleVisibility() but when I tried adding in a couple of print statements, it does not seems to even go pass the `if` statement unless I clicked on the button, only will the print statements within the `if` will be executed, or if I added in setInfo() before the `xxx.toggled.connect()...`
Any ideas? Or any way that I can force the toggleVisibility() to be executed on started up?