Hello, i need some help with code, i need to be able to print something that function returns then i press button on panel1 it should return text to panel2 textctrl in wxpython. Here is some bit of code.(i just cut code that i think is needed for this)
import wx,searchengines
class MyFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, "Simple", size=(900,700))
self.SetMinSize(self.GetSize())
self.panel_one = PanelOne(self)
self.panel_two = PanelTwo(self)
self.panel_two.Hide()
def nextwindow(self,event):
if self.panel_one.IsShown():
self.panel_one.Hide()
self.panel_two.Show()
else:
self.panel_one.Show()
self.panel_two.Hide()
self.Layout()
class PanelOne(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent=parent)
self.inputArea = wx.TextCtrl(self, size=(550,35), style=wx.ALIGN_LEFT)
exOneBtn = buttons.GenBitmapTextButton(self, -1, bmp, "See", size=(100,35))
self.Bind(wx.EVT_BUTTON, self.onbutton, exOneBtn)
self.engine = searchengines.SearchEngines()
def onbutton(self, event):
frame.nextwindow(self)
item = self.inputArea.GetValue()
self.b = self.engine.filest(item)
transferArea.AppendText(self.b) # This line problematic, how to write that something should be printed in panel2 textctrl window? i tried PanelTwo(self).transferArea.AppendText(self.b) no errors but nothing prints out..
class PanelTwo(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent=parent)
self.transferArea = wx.TextCtrl(self, size=(400,600), style = wx.TE_MULTILINE)
if __name__== "__main__":
app = wx.PySimpleApp()
frame = MyFrame()
frame.Show()
app.MainLoop()
i have few questions, how to create object from class PanelTwo if it's possible, i know how, but where to write that line?
Sorry for my noobish questions. I know i need to learn some OOP :)
Thanks