Ok guys, I'm really new at python (and programming itself) so sorry for my ignorance, but I really needed to ask this. So im doing a wxPython project where I added several tabs for a notebook (each tab of the notebook = a class) and there is one tab where I added a checkbox (in a tab, lets call it for example Tab1), and what I want is that when someone checks it, a button that exists in other tab (class called for example tab2) gets hidden where previously it was being shown.
Well I see that it isn't hard to accomplish this, but my problem is the classes (tab1 and tab2, in this example). I've been trying to figure it out by searching but I guess im not searching hard enough because I just can't get it right. If they were in the same class I wouldn't have a problem, but as they are in different classes, im having a huge struggle with this.
Hope someone can help me, and sorry for my ignorance once again.
EDIT: Sorry guys wasn't being shown/hidden, but rather being enabled/disabled.
class Tab2(wx.Panel):
def __init__(self, parent):
.....
self.jaddbutton = wx.Button(self,-1, label ="Button", size = (160,24))
self.jaddbutton.Bind(wx.EVT_BUTTON, self.jaddbuttonclick, self.jaddbutton)
def jaddbuttonclick(self, event):
....
class Tab1(wx.Panel):
def __init__(self, parent):
self.jdcheck = wx.CheckBox(self, -1, 'Disable')
self.jdcheck.Bind(wx.EVT_CHECKBOX, self.checkoptions, self.jdcheck)
def checkoptions(self,event):
checkboxval = self.jdcheck.GetValue()
if checkboxval == False:
self.jaddbutton.Disable() # This is what I want to do but it is on the other class
else:
self.jaddbutton.Enable() # Same as above
class TextFrame(wx.Frame):
def __init__(self):
p = wx.Panel(self)
self.nb = wx.Notebook(p, size = (750, 332))
#Tabs
tab1 = Tab1(self.nb)
tab2 = Tab2(self.nb)
self.nb.AddPage(tab1, "ssomething")
self.nb.AddPage(tab2, "somethingr")