There are a number of questions that are similar to this, but none of the answers hits the spot - so please bear with me.
I am trying my hardest to learn OOP using Python, but i keep running into errors (like this one) which just make me think this is all pointless and it would be easier to just use methods.
Here is my code:
class TheGUI(wx.Frame):
def __init__(self, title, size):
wx.Frame.__init__(self, None, 1, title, size=size)
# The GUI is made ...
textbox.TextCtrl(panel1, 1, pos=(67,7), size=(150, 20))
button1.Bind(wx.EVT_BUTTON, self.button1Click)
self.Show(True)
def button1Click(self, event):
#It needs to do the LoadThread function!
class WebParser:
def LoadThread(self, thread_id):
#It needs to get the contents of textbox!
TheGUI = TheGUI("Text RPG", (500,500))
TheParser = WebParser
TheApp.MainLoop()
So the problem i am having is that the GUI class needs to use a function that is in the WebParser class, and the WebParser class needs to get text from a textbox that exists in the GUI class.
I know i could do this by passing the objects around as parameters, but that seems utterly pointless, there must be a more logical way to do this that doesn't using classes seem so pointless?
Thanks in advance!