Hi All,
I am Siva, I am very new to this group and to wxpython also.
Please forgive me if any error or wrong communication structure.
I am trying to create an application using wxpython.
The app description is,
I am creating a frame, adding two panels to the same frame.
Trying to get the result in panel 2 for the action in panel 1. But I am not getting the result.
Code:
import wx
#Panel 1 class
class PanelOne(wx.Panel):
def __init__(self, parent):
"""Constructor"""
wx.Panel.__init__(self, parent=parent)
self.SetBackgroundColour("Blue")
#Calling function two create a button in panel 1
self.CreateExpiryCheckTogleBtn()
def CreateExpiryCheckTogleBtn(self):
#Button creation
expirychkTogleBtn = wx.ToggleButton(self)
expirychkTogleBtn.SetLabel("Expiry Check")
#Binding the event
self.Bind(wx.EVT_TOGGLEBUTTON, self.OnExpiryTogle, expirychkTogleBtn)
#event function
def OnExpiryTogle(self,event):
#function calling to create UI/widgets/put data in panel 2
self._DoLayout()
def _DoLayout(self):
#main object create
_frame = MyFrame()
#panel 2 object create , pass parent as main frame object
_panel2 = PanelTwo(_frame)
text = wx.StaticText(_panel2, -1,"This is the Toggle button event in Panel 2")
text.Show()
#panel 2
class PanelTwo(wx.Panel):
def __init__(self, parent):
"""Constructor"""
wx.Panel.__init__(self, parent=parent)
self.SetBackgroundColour("black")
#main frame
class MyFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, "Main Frame", size = (1366, 768))
#Spliiting the panels
splitter = wx.SplitterWindow(self)
self.panelone = PanelOne(splitter)
self.paneltwo = PanelTwo(splitter)
splitter.SplitVertically(self.panelone, self.paneltwo,-9 )
splitter.SetMinimumPaneSize(200)
self.sizer = wx.BoxSizer(wx.HORIZONTAL)
self.sizer.Add(splitter, 1, wx.EXPAND)
self.SetSizer(self.sizer)
#app class
class MyApp(wx.App):
def OnInit(self):
frame = MyFrame()
frame.Show()
return True
if __name__ == "__main__":
app = MyApp(False)
print(wx.GetDisplaySize())
app.MainLoop()
Note: Please rectify me if any wrong coding standards or naming standards.
Thanks All in Advance
···
Thanks and Regards,
Jampala Sivanarayana
Save Water. Go Paperless. Always Recycle.