def ToggleWidget(self): """ Swaps listctrl to HTML viewer widget and vice versa. """ if self.whichWidget == "listctrl_drugchoice": if self.html_viewer is not None: return if self.listctrl_drugchoice is not None: self.sizer_left.Remove(self.listctrl_drugchoice) self.listctrl_drugchoice = None self.html_viewer = wx.HtmlWindow(self, -1, size=(400, 200)) self.sizer_left.Add(self.html_viewer, 1, wxGROW | wxALIGN_CENTER_HORIZONTAL, 5) self.sizer_left.Layout() self.whichWidget = "html_viewer" else: if self.listctrl_drugchoice is not None: return if self.html_viewer is not None: self.sizer_left.Remove(self.html_viewer) self.html_viewer = None self.listctrl_drugchoice = wx.ListCtrl(self, ID_LISTCTRL_DRUGCHOICE, wxDefaultPosition, wxSize(400, 200), style=wx.LC_SINGLE_SEL | wx.LC_REPORT) self.sizer_left.Add(self.listctrl_drugchoice, 1, wxGROW | wxALIGN_CENTER_HORIZONTAL, 5) self.sizer_left.Layout() self.whichWidget = "listctrl_drugchoice"
def _init_ctrls(self, prnt): # generated method, don't edit wx.Panel.__init__(self, id=wxID_PANEL, name='Manual', parent=prnt, pos=wx.Point(393, 242), size=wx.Size(513, 363), style=wx.TAB_TRAVERSAL) self._init_utils() self.SetClientSize(wx.Size(505, 339)) self.SetAutoLayout(True) self.htmlWindow1 = wx.HtmlWindow(id=wxID_PANELHTMLWINDOW1, name='htmlWindow1', parent=self, pos=wx.Point(0, 24), size=wx.Size(504, 312)) self.Back = wx.Button(id=wxID_PANELBACK, label='Back', name='Back', parent=self, pos=wx.Point(0, 0), size=wx.Size(75, 23), style=0) EVT_BUTTON(self.Back, wxID_PANELBACK, self.OnBackButton) self.Forward = wx.Button(id=wxID_PANELFORWARD, label='Forward', name='Forward', parent=self, pos=wx.Point(80, 0), size=wx.Size(75, 23), style=0) EVT_BUTTON(self.Forward, wxID_PANELFORWARD, self.OnForwardButton) self.Home = wx.Button(id=wxID_PANELHOME, label='Home', name='Home', parent=self, pos=wx.Point(160, 0), size=wx.Size(75, 23), style=0) EVT_BUTTON(self.Home, wxID_PANELHOME, self.OnHomeButton)