def _LinkBox(parent, hasProps, propObj, propVal, **kwargs): """Creates a 'link' button which toggles synchronisation between the property on the given ``hasProps`` instance, and its parent. """ propName = propObj.getLabel(hasProps) value = hasProps.isSyncedToParent(propName) linkBox = wx.ToggleButton(parent, label='\u21cb', style=wx.BU_EXACTFIT) linkBox.SetValue(value) if (hasProps.getParent() is None) or \ (not hasProps.canBeSyncedToParent( propName)) or \ (not hasProps.canBeUnsyncedFromParent(propName)): linkBox.Enable(False) else: # Update the binding state when the linkbox is modified def onLinkBox(ev): value = linkBox.GetValue() if value: hasProps.syncToParent(propName) else: hasProps.unsyncFromParent(propName) # And update the linkbox when the binding state is modified def onSyncProp(*a): linkBox.SetValue(hasProps.isSyncedToParent(propName)) def onDestroy(ev): ev.Skip() hasProps.removeSyncChangeListener(propName, lName) lName = 'widget_LinkBox_{}_{}'.format(propName, linkBox) linkBox.Bind(wx.EVT_TOGGLEBUTTON, onLinkBox) linkBox.Bind(wx.EVT_WINDOW_DESTROY, onDestroy) hasProps.addSyncChangeListener(propName, lName, onSyncProp, weak=False) return linkBox
def __init__(self, parent, count, topic, type, message_callback, color_callback, pause_callback): wx.Panel.__init__(self, parent, wx.ID_ANY) self._count = count self._message_callback = message_callback self._color_callback = color_callback self._pause_callback = pause_callback self._queue = deque() sizer = wx.BoxSizer(wx.HORIZONTAL) self._timeline = ColoredTimeline(self, 1, 1, 1, self._get_color_for_value) sizer.Add(self._timeline, 1, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self._pause_button = wx.ToggleButton(self, wx.ID_ANY, "Pause") self._pause_button.SetToolTip(wx.ToolTip("Pause message updates")) sizer.Add(self._pause_button, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.SetSizer(sizer) self._pause_button.Bind(wx.EVT_TOGGLEBUTTON, self.on_pause) self._paused = False self._last_msg = None self._tracking_latest = True self.Layout() self._last_val = 2 self._timeline.Bind(wx.EVT_COMMAND_SCROLL_THUMBTRACK, self.on_slider_scroll) self._timeline.Bind(wx.EVT_COMMAND_SCROLL_CHANGED, self.on_slider_scroll) self._subscriber = None if (topic is not None): self._subscriber = rospy.Subscriber(topic, type, self.callback) self._message_receipt_callback = None
def display_letter_btns(): letter_w = letter_h = 50 letter_margin = 10 # Calculate x offset based on frame width, letters width and letter margin # so that the letters keypad is horizontally centered in the frame x_offset = round( (main_frame.Size[0] - 13 * (letter_w + letter_margin)) / 2) y_offset = 400 for index, letter in enumerate(ALPHABET): pos_x = x_offset + (letter_w + letter_margin) * index pos_y = y_offset + letter_h if index >= 13: index -= 13 pos_x = x_offset + (letter_w + letter_margin) * index pos_y = pos_y + letter_h + letter_margin wx.ToggleButton(main_frame, id=wx.ID_ANY, label=letter, pos=wx.Point(pos_x, pos_y), size=wx.Size(letter_w, letter_h)).Bind(wx.EVT_TOGGLEBUTTON, guess_word)
def __init__(self, parent): wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.Size(503, 63), style=wx.TAB_TRAVERSAL) bSizer4 = wx.BoxSizer(wx.HORIZONTAL) self.m_slider1 = wx.Slider( self, wx.ID_ANY, 2, 1, 2, wx.DefaultPosition, wx.DefaultSize, wx.SL_AUTOTICKS | wx.SL_HORIZONTAL | wx.SL_LABELS | wx.SL_TOP) bSizer4.Add(self.m_slider1, 1, wx.ALL, 5) self._pause_button = wx.ToggleButton(self, wx.ID_ANY, u"Pause", wx.DefaultPosition, wx.DefaultSize, 0) bSizer4.Add(self._pause_button, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.SetSizer(bSizer4) self.Layout()
def __init__(self) : wx.Frame.__init__(self,None,pos=wx.DefaultPosition, size=wx.Size(500,500),style=wx.MAXIMIZE_BOX | wx.SYSTEM_MENU | wx.CAPTION | wx.MINIMIZE_BOX| wx.CLOSE_BOX | wx.CLIP_CHILDREN,title="Password Validation") panel= wx.Panel(self) my_sizer = wx.BoxSizer(wx.VERTICAL) lbl1=wx.StaticText(panel,label="Enter Your Name :",size = wx.Size(400,30)) lbl=wx.StaticText(panel,label="Enter Your Password :"******"Note :Enter the valid Password ",size = wx.Size(400,70)) self.txt1 = wx.TextCtrl(panel,style= wx.TE_PROCESS_ENTER,size=(400,30)) self.txt = wx.TextCtrl(panel,style= wx.TE_PROCESS_ENTER,size=(400,30)) self.txt1.SetFocus() self.txt.SetFocus() self.txt1.SetHint("Enter Your Name") self.txt.SetHint("Enter Your Password") self.btn = wx.ToggleButton(panel,-1,"Submit") self.btn.Bind(wx.EVT_TOGGLEBUTTON,self.OnEnter) my_sizer.Add(lbl1, 0,wx.ALL,5) my_sizer.Add(self.txt1,0,wx.ALL,5) my_sizer.Add(lbl, 0,wx.ALL,5) my_sizer.Add(self.txt,0,wx.ALL,5) my_sizer.Add(note,0,wx.ALL,5) my_sizer.Add(self.btn,0,wx.ALIGN_CENTER) panel.SetSizer(my_sizer) self.Show()
def loginUI(self): self.panel = wx.Panel(self) wx.StaticText(self.panel, label="ID : ", pos=(5, 5)) wx.StaticText(self.panel, label="PASS : "******"일반 버튼", pos=(5, 100), size=(70, -1)) btn2 = wx.ToggleButton(self.panel, label="토글 버튼", pos=(90, 100), size=(70, -1)) btn3 = wx.Button(self.panel, label="종료", pos=(180, 100), size=(70, -1)) btn1.id, btn2.id, btn3.id = 1, 2, 3 btn1.Bind(wx.EVT_BUTTON, self.onBtnHandler) btn2.Bind(wx.EVT_TOGGLEBUTTON, self.onBtnHandler) btn3.Bind(wx.EVT_BUTTON, self.onBtnHandler)
def __init__(self, *args, **kw): #调用父类的创建方法 super(HelloFrame, self).__init__(*args, **kw) box = wx.BoxSizer(wx.VERTICAL) bt1 = wx.Button( self, label="关闭窗口", ) bt1.Bind(wx.EVT_BUTTON, self.onCloseWindow) self.bt2 = wx.ToggleButton(self, label='开关') self.bt2.Bind(wx.EVT_TOGGLEBUTTON, self.showFlash) st = wx.TextCtrl( self, value='helloworld', ) box.AddMany([(bt1, 0, wx.ALL | wx.EXPAND, 0), (self.bt2, 0, wx.ALL | wx.EXPAND, 0), (st, 0, wx.ALL | wx.EXPAND | wx.SHAPED, 0)]) self.SetSizer(box)
def __init__(self, parent): """Constructor""" wx.Panel.__init__(self, parent) self.defaultColor = self.GetBackgroundColour() rows = [("Ford", "Taurus", "1996", "Blue"), ("Nissan", "370Z", "2010", "Green"), ("Porche", "911", "2009", "Red") ] self.list_ctrl = wx.ListCtrl(self, style=wx.LC_REPORT) self.list_ctrl.InsertColumn(0, "Make") self.list_ctrl.InsertColumn(1, "Model") self.list_ctrl.InsertColumn(2, "Year") self.list_ctrl.InsertColumn(3, "Color") index = 0 for row in rows: self.list_ctrl.InsertStringItem(index, row[0]) self.list_ctrl.SetStringItem(index, 1, row[1]) self.list_ctrl.SetStringItem(index, 2, row[2]) self.list_ctrl.SetStringItem(index, 3, row[3]) if index % 2: self.list_ctrl.SetItemBackgroundColour(index, "white") else: self.list_ctrl.SetItemBackgroundColour(index, "yellow") index += 1 btn = wx.ToggleButton(self, label="Toggle Dark") btn.Bind(wx.EVT_TOGGLEBUTTON, self.onToggleDark) normalBtn = wx.Button(self, label="Test") sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.list_ctrl, 0, wx.ALL|wx.EXPAND, 5) sizer.Add(btn, 0, wx.ALL, 5) sizer.Add(normalBtn, 0, wx.ALL, 5) self.SetSizer(sizer)
def updateFromInput(self, input): """ We decide what buttons to create based on messages via stdin """ line = input.get().strip() try: # Read in the information [sensor_name, sensor_value] = line.split(",") # Create the new button and add it to the sizer self.buttons.append(wx.ToggleButton(self.panel_1, -1, sensor_name)) big_font = wx.Font(pointSize=24, family=wx.FONTFAMILY_DEFAULT, style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_NORMAL) self.buttons[-1].SetFont(big_font) self.panel_1.GetSizer().Add(self.buttons[-1], 1, wx.EXPAND, 0) # Set the initial value as appropriate if sensor_value == "1": self.buttons[-1].SetValue(True) self.buttons[-1].SetBackgroundColour(wx.Colour(0, 255, 0)) else: self.buttons[-1].SetValue(False) self.buttons[-1].SetBackgroundColour(wx.Colour(255, 0, 0)) self.panel_1.Layout() # Update the frame self.Refresh() # Bind to event handler self.Bind(wx.EVT_TOGGLEBUTTON, self.sensorToggle, self.buttons[-1]) except ValueError: print "(SENSOR) WARNING: Unexpected message received!" self.waitingForInput = False # Make sure another listener gets started
def __init__(self, parent, top): wx.Panel.__init__(self, parent=parent) self.graph = top self.togglebuttonStart = wx.ToggleButton(self, id=-1, label="Start", pos=(10, 10)) self.togglebuttonStart.Bind(wx.EVT_TOGGLEBUTTON, self.OnStartClick) labelChannels = wx.StaticText(self, -1, "Analog Inputs", pos=(200, 10)) self.cb1 = wx.CheckBox(self, -1, label="A0", pos=(200, 30)) self.cb2 = wx.CheckBox(self, -1, label="A1", pos=(200, 45)) self.cb3 = wx.CheckBox(self, -1, label="A2", pos=(200, 60)) self.cb4 = wx.CheckBox(self, -1, label="A3", pos=(200, 75)) self.Bind(wx.EVT_CHECKBOX, self.OnChecked) self.textboxSampleTime = wx.TextCtrl(self, -1, "1000", pos=(200, 115), size=(50, -1)) self.buttonSend = wx.Button(self, -1, "Send", pos=(250, 115), size=(50, -1)) self.buttonSend.Bind(wx.EVT_BUTTON, self.OnSend) labelMinY = wx.StaticText(self, -1, "Min Y ", pos=(400, 10)) self.textboxMinYAxis = wx.TextCtrl(self, -1, "0", pos=(400, 30)) labelMaxY = wx.StaticText(self, -1, "Max Y", pos=(400, 60)) self.textboxMaxYAxis = wx.TextCtrl(self, -1, "1024", pos=(400, 80)) self.buttonRange = wx.Button(self, 01, "Set Y Axis", pos=(400, 105)) self.buttonRange.Bind(wx.EVT_BUTTON, self.SetButtonRange)
def __init_buttons(self): vbox = wx.BoxSizer(wx.VERTICAL) grid_box = wx.GridSizer(rows=3, cols=3, hgap=5, vgap=5) for color in colors: self.__bt_color[color] = wx.ToggleButton(self, name=color) self.__bt_color["blue"].SetValue(True) for color in colors: self.__bt_color[color].SetBitmap(Immagini.color_bricks[color]) grid_box.Add(self.__bt_color[color], 0, wx.EXPAND | wx.CENTER) vbox.Add(wx.StaticBitmap(self, bitmap=Immagini.color_label), 0, wx.EXPAND | wx.CENTER) vbox.Add(grid_box, 0, wx.EXPAND | wx.CENTER) self.SetSizerAndFit(vbox) self.Bind(wx.EVT_TOGGLEBUTTON, self.on_click_blue, self.__bt_color[ID_BLUE]) self.Bind(wx.EVT_TOGGLEBUTTON, self.on_click_green, self.__bt_color[ID_GREEN]) self.Bind(wx.EVT_TOGGLEBUTTON, self.on_click_purple, self.__bt_color[ID_PURPLE]) self.Bind(wx.EVT_TOGGLEBUTTON, self.on_click_red, self.__bt_color[ID_RED]) self.Bind(wx.EVT_TOGGLEBUTTON, self.on_click_orange, self.__bt_color[ID_ORANGE]) self.Bind(wx.EVT_TOGGLEBUTTON, self.on_click_light_blue, self.__bt_color[ID_LIGHT_BLUE]) self.Bind(wx.EVT_TOGGLEBUTTON, self.on_click_yellow, self.__bt_color[ID_YELLOW]) self.Bind(wx.EVT_TOGGLEBUTTON, self.on_click_dark_green, self.__bt_color[ID_DARK_GREEN]) self.Bind(wx.EVT_TOGGLEBUTTON, self.on_click_brown, self.__bt_color[ID_BROWN])
def __init__(self, parent, wxId, id, style): # Create a wxButton of the appropriate type. if style != Button.STYLE_MINI: widget = wx.Button(parent, wxId, uniConv(language.translate(id))) else: widget = wx.ToggleButton(parent, wxId, uniConv(language.translate(id))) # Default buttons are usually a bit different visually. if style == Button.STYLE_DEFAULT: widget.SetDefault() base.Widget.__init__(self, widget) self.widgetId = id if style == Button.STYLE_MINI: # The mini buttons use the small style. self.setSmallStyle() # The size of the mini buttons is configurable. bestSize = widget.GetBestSize() width = 30 height = bestSize[1] try: width = st.getSystemInteger('button-mini-width') if st.getSystemInteger('button-mini-height'): height = st.getSystemInteger('button-mini-height') except: pass widget.SetMinSize((width, height)) if style != Button.STYLE_MINI: # We will handle the click event ourselves. wx.EVT_BUTTON(parent, wxId, self.onClick) #self.updateDefaultSize() else: # Pop back up when toggled down. wx.EVT_TOGGLEBUTTON(parent, wxId, self.onToggle)
def CreateInteriorWindowComponents(self): ''' Create "interior" window components. In this case it is the attack picture. ''' sizer = wx.BoxSizer(wx.VERTICAL) # Make zoom buttons if Preference.usePIL(): buttons = wx.BoxSizer(wx.HORIZONTAL) bt = wx.ToggleButton(self,-1,"Fit to window") bt.SetValue(self.fit) buttons.Add(bt,0) self.Bind(wx.EVT_TOGGLEBUTTON, self.OnFit, bt) sizer.Add(buttons, 0, wx.ALIGN_LEFT) # Add attacks (possible with tabs) self.displays=[] attacks = self.claim.attacks n = len(attacks) if n <= 1: # Just a single window dp = AttackDisplay(self, self, attacks[0]) self.displays.append(dp) else: # Multiple tabs dp = wx.Notebook(self,-1) for i in range(0,n): disp = AttackDisplay(self,dp,attacks[i]) classname = "%s %i" % (self.claim.stateName(1,True),(i+1)) dp.AddPage(disp, classname) self.displays.append(disp) sizer.Add(dp, 1, wx.EXPAND,1) self.SetSizer(sizer)
def InitUi(self): panel = wx.Panel(self) wx.StaticText(panel, label = 'i d : ', pos = (5, 5)) wx.StaticText(panel, label = 'pwd : ', pos = (5, 40)) self.txt1 = wx.TextCtrl(panel, pos = (50, 5), size = (50, -1)) #-1 : text의 높이(기본값)만큼 알아서 잡아줌 self.txt2 = wx.TextCtrl(panel, pos = (50, 40)) #Button btn1 = wx.Button(panel, label='일반버튼', pos = (5, 100)) btn2 = wx.ToggleButton(panel, label='토글버튼', pos = (100, 100)) btn3 = wx.Button(panel, label='종료', pos = (200, 100), size = (50, -1)) ''' #event btn1.Bind(wx.EVT_BUTTON, self.onClick1) btn2.Bind(wx.ToggleButton, self.onClick2) btn3.Bind(wx.EVT_BUTTON, self.onClick3) ''' #event btn1.Bind(wx.EVT_BUTTON, self.onMethod) btn2.Bind(wx.EVT_TOGGLEBUTTON, self.onMethod) btn3.Bind(wx.EVT_BUTTON, self.onMethod) btn1.id=1; btn2.id=2; btn3.id=3;
def __init__(self, *args, **kwds): # this line will stay: transfer stereo setting to class wxVTKRenderWindowInteractor.USE_STEREO = S3DV_STEREO print "s3dv Frames STEREO:", S3DV_STEREO # begin wxGlade: threedFrame.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.panel_1 = wx.Panel(self, -1) self.showControlsButtonId = wx.NewId() self.button_2 = wx.Button(self.panel_1, self.showControlsButtonId, "Show Controls") self.resetAllButtonId = wx.NewId() self.button = wx.Button(self.panel_1, self.resetAllButtonId, "Reset All") self.resetCameraButtonId = wx.NewId() self.resetCameraButton = wx.Button(self.panel_1, self.resetCameraButtonId, "Reset Camera") self.projectionChoiceId = wx.NewId() self.projectionChoice = wx.Choice( self.panel_1, self.projectionChoiceId, choices=["Perspective", "Orthogonal"]) self.freeze_slices_button = wx.ToggleButton(self.panel_1, -1, "&Freeze slices") self.introspectButton = wx.Button(self.panel_1, -1, "Introspect") self.introspectPipelineButtonId = wx.NewId() self.button_5 = wx.Button(self.panel_1, self.introspectPipelineButtonId, "Pipeline") self.saveImageButton = wx.Button(self.panel_1, -1, "Save Image") self.threedRWI = wxVTKRenderWindowInteractor(self.panel_1, -1) self.__set_properties() self.__do_layout()
def loginUI(self): # 부모클래스에서도 사용이 가능하게 해준다. self.panel = wx.Panel(self) wx.StaticText(self.panel, label="ID : ", pos=(5, 5)) wx.StaticText(self.panel, label="pass : "******"일반버튼", pos=(5, 100), size=(70, -1)) btn2 = wx.ToggleButton(self.panel, label="토글버튼", pos=(95, 100), size=(70, -1)) btn3 = wx.Button(self.panel, label="종료", pos=(185, 100), size=(70, -1)) # 하나의 메서드로 처리 btn1.id = 1 btn1.Bind(wx.EVT_BUTTON, self.onButtonHandler) btn2.id = 2 btn2.Bind(wx.EVT_TOGGLEBUTTON, self.onButtonHandler) btn3.id = 3 btn3.Bind(wx.EVT_BUTTON, self.onButtonHandler)
def InitUI(self): self.SetBackgroundColour("white") self.path_txt = wx.TextCtrl(self, 113, " ", style=wx.TE_LEFT) self.manage.Show() self.manageon_btn = wx.ToggleButton(self, -1, u'\u25c4', wx.DefaultPosition, (12, -1), wx.BORDER_NONE) # 25ba self.manageon_btn.SetFont( wx.Font(10, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, "Segoe UI Semibold")) self.tool_sizer = wx.BoxSizer(wx.VERTICAL) self.tool_sizer.Add(self.tool, 0, wx.EXPAND) self.tool_sizer.Add(self.path_txt, 0, wx.EXPAND) self.framework_sizer = wx.BoxSizer(wx.HORIZONTAL) self.framework_sizer.Add(self.manageon_btn, 0, wx.EXPAND | wx.RIGHT, 5) self.framework_sizer.Add(self.manage, 0, wx.EXPAND) self.framework_sizer.Add(self.taskmode, 1, wx.EXPAND) self.framework_sizer.Add(self.auiframe, 1, wx.EXPAND) self.displaymode.Hide() self.analysismode.Hide() self.manageon_btn.Bind(wx.EVT_TOGGLEBUTTON, self.OnClose) self.tool.Bind(wx.EVT_TOOL, self.OnTask, id=111) self.tool.Bind(wx.EVT_TOOL, self.OnDisplay, id=112) self.tool.Bind(wx.EVT_TOOL, self.OnAnalysis, id=113) # Use for pubsub --> get manage.dir path to pass path_txt self.manage.dir.Bind(wx.EVT_DIRCTRL_FILEACTIVATED, self.Update_path) self.tool_sizer.Add(self.framework_sizer, 1, wx.EXPAND | wx.ALL, 5) self.Centre(wx.BOTH) self.SetSizer(self.tool_sizer) # self.Fit() # self.FitInside() self.SetAutoLayout(True) self.Fit() self.Maximize(True) self.Show(True) self.path_txt.SetValue(os.path.abspath(__file__))
def __init__(self, parent): wx.Panel.__init__(self, parent) #start toggle button to start/pause the program and textctrl to #entry output file name self.toggle = wx.ToggleButton(self, label="Start") self.txt_output_file = wx.TextCtrl(self, size=(440, 30)) horizontal = wx.BoxSizer(wx.HORIZONTAL) horizontal.Add(self.toggle, 1, wx.EXPAND | wx.GROW) horizontal.Add(self.txt_output_file, 1, wx.EXPAND | wx.GROW) #text box for event logging self.log_text = wx.TextCtrl(self, -1, size=(440, 30), style=wx.TE_MULTILINE) self.log_text.SetFont( wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.NORMAL, False)) horizontal.Add(self.log_text, 1, wx.EXPAND | wx.GROW) self.SetSizer(horizontal)
def create_window(self, dialog): """ Create a window to do the structural analysis. Args: self dialog """ # Making the window window = wx.Panel(dialog, pos=(5, 100), size=(300, 155)) wx.StaticText(window, -1, 'Select nodes to arrange in circle', (15, 10)) # Use default radius wx.StaticText(window, -1, 'Use default radius:', (15, 30)) self.defaultCheck = wx.CheckBox(window, -1, pos=(150, 30)) self.defaultCheck.SetValue(True) # Making radius setable wx.StaticText(window, -1, 'Input desired radius:', (15, 55)) self.radiusText = wx.TextCtrl(window, -1, '0', (150, 55), size=(120, 22)) self.radiusText.SetInsertionPoint(0) self.radiusText.Bind(wx.EVT_TEXT, self.OnText_radius) # binding test self.radiusValue = float(self.radiusText.GetValue()) # Making the toggle button apply_btn = wx.ToggleButton(window, -1, 'Apply', (100, 85), size=(80, 22)) apply_btn.SetValue(False) # Binding the method to the button apply_btn.Bind(wx.EVT_TOGGLEBUTTON, self.Apply) return window
def __init__(self, parent, id=wx.ID_ANY, title="", pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE, log=None): wx.Frame.__init__(self, parent, id, title, pos, size, style) panel = wx.Panel(self) self._ribbon = RB.RibbonBar(panel, wx.ID_ANY) self._bitmap_creation_dc = wx.MemoryDC() self._colour_data = wx.ColourData() home = RB.RibbonPage(self._ribbon, wx.ID_ANY, "Examples", CreateBitmap("ribbon")) toolbar_panel = RB.RibbonPanel( home, wx.ID_ANY, "Toolbar", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, agwStyle=RB.RIBBON_PANEL_NO_AUTO_MINIMISE) toolbar = RB.RibbonToolBar(toolbar_panel, ID_MAIN_TOOLBAR) toolbar.AddTool(wx.ID_ANY, CreateBitmap("align_left")) toolbar.AddTool(wx.ID_ANY, CreateBitmap("align_center")) toolbar.AddTool(wx.ID_ANY, CreateBitmap("align_right")) toolbar.AddSeparator() toolbar.AddHybridTool( wx.ID_NEW, wx.ArtProvider.GetBitmap(wx.ART_NEW, wx.ART_OTHER, wx.Size(16, 15))) toolbar.AddTool( wx.ID_ANY, wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, wx.Size(16, 15))) toolbar.AddTool( wx.ID_ANY, wx.ArtProvider.GetBitmap(wx.ART_FILE_SAVE, wx.ART_OTHER, wx.Size(16, 15))) toolbar.AddTool( wx.ID_ANY, wx.ArtProvider.GetBitmap(wx.ART_FILE_SAVE_AS, wx.ART_OTHER, wx.Size(16, 15))) toolbar.AddSeparator() toolbar.AddDropdownTool( wx.ID_UNDO, wx.ArtProvider.GetBitmap(wx.ART_UNDO, wx.ART_OTHER, wx.Size(16, 15))) toolbar.AddDropdownTool( wx.ID_REDO, wx.ArtProvider.GetBitmap(wx.ART_REDO, wx.ART_OTHER, wx.Size(16, 15))) toolbar.AddSeparator() toolbar.AddTool( wx.ID_ANY, wx.ArtProvider.GetBitmap(wx.ART_REPORT_VIEW, wx.ART_OTHER, wx.Size(16, 15))) toolbar.AddTool( wx.ID_ANY, wx.ArtProvider.GetBitmap(wx.ART_LIST_VIEW, wx.ART_OTHER, wx.Size(16, 15))) toolbar.AddSeparator() toolbar.AddHybridTool( ID_POSITION_LEFT, CreateBitmap("position_left"), "Align ribbonbar vertically\non the left\nfor demonstration purposes" ) toolbar.AddHybridTool( ID_POSITION_TOP, CreateBitmap("position_top"), "Align the ribbonbar horizontally\nat the top\nfor demonstration purposes" ) toolbar.AddSeparator() toolbar.AddHybridTool( wx.ID_PRINT, wx.ArtProvider.GetBitmap(wx.ART_PRINT, wx.ART_OTHER, wx.Size(16, 15)), "This is the Print button tooltip\ndemonstrating a tooltip") toolbar.SetRows(2, 3) selection_panel = RB.RibbonPanel(home, wx.ID_ANY, "Selection", CreateBitmap("selection_panel")) selection = RB.RibbonButtonBar(selection_panel) selection.AddSimpleButton( ID_SELECTION_EXPAND_V, "Expand Vertically", CreateBitmap("expand_selection_v"), "This is a tooltip for Expand Vertically\ndemonstrating a tooltip") selection.AddSimpleButton(ID_SELECTION_EXPAND_H, "Expand Horizontally", CreateBitmap("expand_selection_h"), "") selection.AddButton(ID_SELECTION_CONTRACT, "Contract", CreateBitmap("auto_crop_selection"), CreateBitmap("auto_crop_selection_small")) shapes_panel = RB.RibbonPanel(home, wx.ID_ANY, "Shapes", CreateBitmap("circle_small")) shapes = RB.RibbonButtonBar(shapes_panel) shapes.AddButton( ID_CIRCLE, "Circle", CreateBitmap("circle"), CreateBitmap("circle_small"), help_string= "This is a tooltip for the circle button\ndemonstrating another tooltip", kind=RB.RIBBON_BUTTON_TOGGLE) shapes.AddSimpleButton(ID_CROSS, "Cross", CreateBitmap("cross"), "") shapes.AddHybridButton(ID_TRIANGLE, "Triangle", CreateBitmap("triangle")) shapes.AddSimpleButton(ID_SQUARE, "Square", CreateBitmap("square"), "") shapes.AddDropdownButton(ID_POLYGON, "Other Polygon", CreateBitmap("hexagon"), "") sizer_panel = RB.RibbonPanel(home, wx.ID_ANY, "Panel with Sizer", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, agwStyle=RB.RIBBON_PANEL_DEFAULT_STYLE) strs = ["Item 1 using a box sizer now", "Item 2 using a box sizer now"] sizer_panelcombo = wx.ComboBox(sizer_panel, wx.ID_ANY, "", wx.DefaultPosition, wx.DefaultSize, strs, wx.CB_READONLY) sizer_panelcombo2 = wx.ComboBox(sizer_panel, wx.ID_ANY, "", wx.DefaultPosition, wx.DefaultSize, strs, wx.CB_READONLY) sizer_panelcombo.Select(0) sizer_panelcombo2.Select(1) sizer_panelcombo.SetMinSize(wx.Size(150, -1)) sizer_panelcombo2.SetMinSize(wx.Size(150, -1)) # not using wx.WrapSizer(wx.HORIZONTAL) as it reports an incorrect min height sizer_panelsizer = wx.BoxSizer(wx.VERTICAL) sizer_panelsizer.AddStretchSpacer(1) sizer_panelsizer.Add(sizer_panelcombo, 0, wx.ALL | wx.EXPAND, 2) sizer_panelsizer.Add(sizer_panelcombo2, 0, wx.ALL | wx.EXPAND, 2) sizer_panelsizer.AddStretchSpacer(1) sizer_panel.SetSizer(sizer_panelsizer) label_font = wx.Font(8, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_LIGHT) self._bitmap_creation_dc.SetFont(label_font) scheme = RB.RibbonPage(self._ribbon, wx.ID_ANY, "Appearance", CreateBitmap("eye")) self._default_primary, self._default_secondary, self._default_tertiary = self._ribbon.GetArtProvider( ).GetColourScheme(1, 1, 1) provider_panel = RB.RibbonPanel( scheme, wx.ID_ANY, "Art", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, agwStyle=RB.RIBBON_PANEL_NO_AUTO_MINIMISE) provider_bar = RB.RibbonButtonBar(provider_panel, wx.ID_ANY) provider_bar.AddSimpleButton( ID_DEFAULT_PROVIDER, "Default Provider", wx.ArtProvider.GetBitmap(wx.ART_QUESTION, wx.ART_OTHER, wx.Size(32, 32)), "") provider_bar.AddSimpleButton(ID_AUI_PROVIDER, "AUI Provider", CreateBitmap("aui_style"), "") provider_bar.AddSimpleButton(ID_MSW_PROVIDER, "MSW Provider", CreateBitmap("msw_style"), "") primary_panel = RB.RibbonPanel(scheme, wx.ID_ANY, "Primary Colour", CreateBitmap("colours")) self._primary_gallery = self.PopulateColoursPanel( primary_panel, self._default_primary, ID_PRIMARY_COLOUR) secondary_panel = RB.RibbonPanel(scheme, wx.ID_ANY, "Secondary Colour", CreateBitmap("colours")) self._secondary_gallery = self.PopulateColoursPanel( secondary_panel, self._default_secondary, ID_SECONDARY_COLOUR) dummy_2 = RB.RibbonPage(self._ribbon, wx.ID_ANY, "Empty Page", CreateBitmap("empty")) dummy_3 = RB.RibbonPage(self._ribbon, wx.ID_ANY, "Another Page", CreateBitmap("empty")) self._ribbon.Realize() self._logwindow = wx.TextCtrl( panel, wx.ID_ANY, "", wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_LEFT | wx.TE_BESTWRAP | wx.BORDER_NONE) self._togglePanels = wx.ToggleButton(panel, ID_TOGGLE_PANELS, "&Toggle panels") self._togglePanels.SetValue(True) s = wx.BoxSizer(wx.VERTICAL) s.Add(self._ribbon, 0, wx.EXPAND) s.Add(self._logwindow, 1, wx.EXPAND) s.Add(self._togglePanels, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 10) panel.SetSizer(s) self.panel = panel self.BindEvents([selection, shapes, provider_bar]) self.SetIcon(images.Mondrian.Icon) self.CenterOnScreen() self.Show()
def __init__(self, parent=None, title='my title', size=(800, 600)): """ build wxpython frame, including it's layout,event,control :param parent: none :param title: software name :param size: softsware size """ wx.Frame.__init__(self, parent=parent, title=title, size=size) self.Centre() self.panel = wx.Panel(self, -1) self.gauge_count = 0 self.log_is_begin = True self.model_archi = '' self.model_weigh = '' self.input_files_path = '' self.output_path = '' '''text,button''' self.text_intro = wx.StaticText(self.panel, -1, 'Clothes-classfier by deep learning', pos=(180, 0)) # self.text_intro.SetBackgroundColour('green') self.text_intro.SetFont(wx.Font(26, wx.SWISS, wx.NORMAL, wx.BOLD)) self.text_line = wx.StaticLine(self.panel) self.text_archi = wx.StaticText(self.panel, -1, 'load model architecture:') self.text_archi.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD)) self.text_weigh = wx.StaticText(self.panel, -1, 'load model weights:') self.load_model_archi = wx.FilePickerCtrl( self.panel, 2, wildcard='*.json', path='path_to_model_architecture(*.json)', size=(400, -1)) self.load_model_weigh = wx.FilePickerCtrl( self.panel, 3, wildcard='*.h5', path='path_to_model_weights(*.h5)', size=(400, -1)) self.text_load_pic = wx.StaticText( self.panel, -1, 'pictures folder(must only contain pictures):') self.text_res_output = wx.StaticText(self.panel, -1, 'result output folder:') self.load_pic = wx.DirPickerCtrl( self.panel, 4, path='path_to_pic', size=(400, -1), message='input must be dir') #message is tips when browse path self.output_res = wx.DirPickerCtrl(self.panel, 4, path='output_result', size=(400, -1), message='output must be dir') self.text_output_name = wx.StaticText( self.panel, -1, 'save predict result name(*.csv):') self.ctrl_output_name = wx.TextCtrl(self.panel, -1) self.ctrl_output_name_button = wx.Button(self.panel, -1, 'save') self.gauge_training = wx.Gauge(self.panel, -1) self.text_logging = wx.StaticText(self.panel, -1, 'process log:') self.logging_output = wx.TextCtrl(self.panel, -1, style=wx.TE_MULTILINE | wx.TE_RICH, size=(400, 80)) # self.button_clf = wx.Button(self.panel,-1,'Classify',size=(100,100),) self.button_clf = wx.ToggleButton(self.panel, -1, 'Classify') self.button_clf.SetFont(wx.Font(20, wx.SWISS, wx.NORMAL, wx.BOLD)) # self.button_clf.SetBackgroundColour('AQUAMARINE') '''event''' self.load_model_archi.Bind(wx.EVT_FILEPICKER_CHANGED, self.event_getpath, self.load_model_archi) self.load_model_weigh.Bind(wx.EVT_FILEPICKER_CHANGED, self.event_getpath, self.load_model_weigh) self.load_pic.Bind(wx.EVT_DIRPICKER_CHANGED, self.event_getpath, self.load_pic) self.output_res.Bind(wx.EVT_DIRPICKER_CHANGED, self.event_getpath, self.output_res) # self.ctrl_output_name.Bind(wx.EVT_TEXT,self.on_text_path) self.ctrl_output_name_button.Bind(wx.EVT_BUTTON, self.on_text_path_sure) self.gauge_training.Bind(wx.EVT_IDLE, self.do_gauge) self.button_clf.Bind(wx.EVT_TOGGLEBUTTON, self.begin_classify, self.button_clf) # wx.CallAfter(self.dologging) '''get info for model''' self.model_archi = self.load_model_archi.GetPath() self.model_weigh = self.load_model_weigh.GetPath() self.input_files_path = self.load_pic.GetPath() self.output_path = self.output_res.GetPath() self.output_csv_name = '' """layout""" main_sizer = wx.BoxSizer(wx.VERTICAL) main_sizer.Add(self.text_intro, 0, flag=wx.CENTER) main_sizer.Add(self.text_line, 0, flag=wx.EXPAND) main_sizer.Add((20, 20)) left_sizer = wx.BoxSizer(wx.VERTICAL) left_sizer.Add(self.sizer_model_staticbox( 'Load Model', text=[self.text_archi, self.text_weigh], item=[self.load_model_archi, self.load_model_weigh]), 1, flag=wx.EXPAND) left_sizer.Add((10, 10)) #ctrl_text and it's button left_down_sizer = wx.BoxSizer(wx.HORIZONTAL) left_down_sizer.Add(self.ctrl_output_name, 1, wx.EXPAND) left_down_sizer.Add(self.ctrl_output_name_button, 0) left_sizer.Add(self.sizer_model_staticbox( 'Input-dir Output-file', text=[self.text_load_pic, self.text_res_output], item=[self.load_pic, self.output_res]), 1, flag=wx.BOTTOM | wx.EXPAND | wx.ALL) left_sizer.Add((10, 10)) left_sizer.Add(self.text_output_name, 0) left_sizer.Add(left_down_sizer, 0, wx.EXPAND) middle_sizer = wx.BoxSizer(wx.VERTICAL) middle_top_sizer = wx.BoxSizer(wx.VERTICAL) middle_top_sizer.Add(self.button_clf, 1, flag=wx.CENTER) middle_top_sizer.Add(self.gauge_training, 1, flag=wx.EXPAND) middle_sizer.Add(middle_top_sizer, 1, flag=wx.EXPAND) middle_sizer.Add((10, 10)) log_box = wx.StaticBox(self.panel, -1, 'Result') logsizer = wx.StaticBoxSizer(log_box, wx.VERTICAL) logsizer.Add(self.sizer_load_model(self.text_logging, self.logging_output, flag=wx.EXPAND | wx.ALL), 1, flag=wx.BOTTOM | wx.EXPAND | wx.ALL) middle_sizer.Add(logsizer, 1, flag=wx.BOTTOM | wx.EXPAND | wx.ALL) core_sizer = wx.BoxSizer(wx.HORIZONTAL) core_sizer.Add(left_sizer, 1, flag=wx.LEFT | wx.EXPAND | wx.ALL) core_sizer.Add(middle_sizer, 1, flag=wx.EXPAND | wx.ALL) main_sizer.Add(core_sizer, 1, wx.ALL, 5) self.panel.SetSizer(main_sizer) main_sizer.Fit(self) Publisher.subscribe(self.dologging, 'update') Publisher.subscribe(self.do_gauge, 'update_gauge')
def __init__( self, parent, scopeState, winid=-1, ): # begin wxGlade: MyFrame1.__init__ #kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Panel.__init__(self, parent, winid) #self.cam = cam self.scopeState = scopeState self.laserNames = [] for k in self.scopeState.keys(): m = re.match(r'Lasers\.(?P<laser_name>.*)\.Power', k) if not m is None: self.laserNames.append(m.group('laser_name')) self.laserNames.sort() #self.lasers = [l for l in lasers if l.IsPowerControlable()] #self.laserNames=[l.GetName() for l in lasers] self.sliders = [] self.labels = [] self.buttons = [] self.sliding = False self.mode = SCALING_MODES[config.get('laser-slider-scaling', default='log')] sizer_2 = wx.BoxSizer(wx.VERTICAL) for c, laserName in enumerate(self.laserNames): sz = wx.BoxSizer(wx.HORIZONTAL) b = wx.ToggleButton(self, -1, laserName, style=wx.BU_EXACTFIT) b.Bind(wx.EVT_TOGGLEBUTTON, self.on_toggle) self.buttons.append(b) sz.Add(b, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2) if self.mode == 1: min_power = 0 max_power = 100 else: min_power = self.scopeState['Lasers.%s.MinPower' % laserName] max_power = self.scopeState['Lasers.%s.MaxPower' % laserName] sl = wx.Slider( self, -1, self.scopeState['Lasers.%s.Power' % laserName], minValue=min_power, maxValue=max_power, size=wx.Size(150, -1), style=wx.SL_HORIZONTAL) #|wx.SL_AUTOTICKS|wx.SL_LABELS) if wx.version() < '4': #FIXME for wx >= 4 sl.SetTickFreq(10, 1) sz.Add(sl, 1, wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 2) self.sliders.append(sl) l = wx.StaticText(self, -1, '100.0') self.labels.append(l) sz.Add(l, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2) sizer_2.Add(sz, 1, wx.EXPAND, 0) #sizer_2.AddSpacer(5) self.Bind(wx.EVT_SCROLL, self.onSlide) # discover our switchable (but not power controllable) lasers self.switchedLaserNames = [] self.cBoxes = [] for k in self.scopeState.keys(): m = re.match(r'Lasers\.(?P<laser_name>.*)\.On', k) if m is not None: ln = m.group('laser_name') if ln not in self.laserNames: self.switchedLaserNames.append(ln) self.switchedLaserNames.sort() hsizer = wx.BoxSizer(wx.HORIZONTAL) n = 0 self.cBoxes = [] for laserName in self.switchedLaserNames: cb = wx.CheckBox(self, -1, laserName) cb.SetValue(self.scopeState['Lasers.%s.On' % laserName]) cb.Bind(wx.EVT_CHECKBOX, self.OnCbOn) self.cBoxes.append(cb) hsizer.Add(cb, 1, wx.EXPAND, 0) n += 1 if (n % 3) == 0: sizer_2.Add(hsizer, 0, wx.EXPAND, 0) hsizer = wx.BoxSizer(wx.HORIZONTAL) sizer_2.Add(hsizer, 0, wx.EXPAND, 0) #self.SetAutoLayout(1) self.SetSizer(sizer_2) sizer_2.Fit(self)
def __init__(self, parent, config): # Settting the GUI size and panels design displays = (wx.Display(i) for i in range(wx.Display.GetCount()) ) # Gets the number of displays screenSizes = [ display.GetGeometry().GetSize() for display in displays ] # Gets the size of each display index = 0 # For display 1. screenWidth = screenSizes[index][0] screenHeight = screenSizes[index][1] self.gui_size = (screenWidth * 0.7, screenHeight * 0.85) wx.Frame.__init__(self, parent, id=wx.ID_ANY, title='DeepLabCut2.0 - Labeling ToolBox', size=wx.Size(self.gui_size), pos=wx.DefaultPosition, style=wx.RESIZE_BORDER | wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) self.statusbar = self.CreateStatusBar() self.statusbar.SetStatusText( "Looking for a folder to start labeling. Click 'Load frames' to begin." ) self.Bind(wx.EVT_CHAR_HOOK, self.OnKeyPressed) self.SetSizeHints( wx.Size(self.gui_size) ) # This sets the minimum size of the GUI. It can scale now! ################################################################################################################################################### # Spliting the frame into top and bottom panels. Bottom panels contains the widgets. The top panel is for showing images and plotting! topSplitter = wx.SplitterWindow(self) vSplitter = wx.SplitterWindow(topSplitter) self.image_panel = ImagePanel(vSplitter, config, self.gui_size) self.choice_panel = ScrollPanel(vSplitter) vSplitter.SplitVertically(self.image_panel, self.choice_panel, sashPosition=self.gui_size[0] * 0.8) vSplitter.SetSashGravity(1) self.widget_panel = WidgetPanel(topSplitter) topSplitter.SplitHorizontally(vSplitter, self.widget_panel, sashPosition=self.gui_size[1] * 0.83) #0.9 topSplitter.SetSashGravity(1) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(topSplitter, 1, wx.EXPAND) self.SetSizer(sizer) ################################################################################################################################################### # Add Buttons to the WidgetPanel and bind them to their respective functions. widgetsizer = wx.WrapSizer(orient=wx.HORIZONTAL) self.load = wx.Button(self.widget_panel, id=wx.ID_ANY, label="Load frames") widgetsizer.Add(self.load, 1, wx.ALL, 15) self.load.Bind(wx.EVT_BUTTON, self.browseDir) self.prev = wx.Button(self.widget_panel, id=wx.ID_ANY, label="<<Previous") widgetsizer.Add(self.prev, 1, wx.ALL, 15) self.prev.Bind(wx.EVT_BUTTON, self.prevImage) self.prev.Enable(False) self.next = wx.Button(self.widget_panel, id=wx.ID_ANY, label="Next>>") widgetsizer.Add(self.next, 1, wx.ALL, 15) self.next.Bind(wx.EVT_BUTTON, self.nextImage) self.next.Enable(False) self.help = wx.Button(self.widget_panel, id=wx.ID_ANY, label="Help") widgetsizer.Add(self.help, 1, wx.ALL, 15) self.help.Bind(wx.EVT_BUTTON, self.helpButton) self.help.Enable(True) # self.zoom = wx.ToggleButton(self.widget_panel, label="Zoom") widgetsizer.Add(self.zoom, 1, wx.ALL, 15) self.zoom.Bind(wx.EVT_TOGGLEBUTTON, self.zoomButton) self.widget_panel.SetSizer(widgetsizer) self.zoom.Enable(False) self.home = wx.Button(self.widget_panel, id=wx.ID_ANY, label="Home") widgetsizer.Add(self.home, 1, wx.ALL, 15) self.home.Bind(wx.EVT_BUTTON, self.homeButton) self.widget_panel.SetSizer(widgetsizer) self.home.Enable(False) self.pan = wx.ToggleButton(self.widget_panel, id=wx.ID_ANY, label="Pan") widgetsizer.Add(self.pan, 1, wx.ALL, 15) self.pan.Bind(wx.EVT_TOGGLEBUTTON, self.panButton) self.widget_panel.SetSizer(widgetsizer) self.pan.Enable(False) self.lock = wx.CheckBox(self.widget_panel, id=wx.ID_ANY, label="Lock View") widgetsizer.Add(self.lock, 1, wx.ALL, 15) self.lock.Bind(wx.EVT_CHECKBOX, self.lockChecked) self.widget_panel.SetSizer(widgetsizer) self.lock.Enable(False) self.save = wx.Button(self.widget_panel, id=wx.ID_ANY, label="Save") widgetsizer.Add(self.save, 1, wx.ALL, 15) self.save.Bind(wx.EVT_BUTTON, self.saveDataSet) self.save.Enable(False) widgetsizer.AddStretchSpacer(15) self.quit = wx.Button(self.widget_panel, id=wx.ID_ANY, label="Quit") widgetsizer.Add(self.quit, 1, wx.ALL | wx.ALIGN_RIGHT, 15) self.quit.Bind(wx.EVT_BUTTON, self.quitButton) self.widget_panel.SetSizer(widgetsizer) self.widget_panel.SetSizerAndFit(widgetsizer) self.widget_panel.Layout() ############################################################################################################################### # Variables initialization self.currentDirectory = os.getcwd() self.index = [] self.iter = [] self.file = 0 self.updatedCoords = [] self.dataFrame = None self.config_file = config self.new_labels = False self.buttonCounter = [] self.bodyparts2plot = [] self.drs = [] self.num = [] self.view_locked = False # Workaround for MAC - xlim and ylim changed events seem to be triggered too often so need to make sure that the # xlim and ylim have actually changed before turning zoom off self.prezoom_xlim = [] self.prezoom_ylim = []
def __init__(self, filenames=[], size=(800, 580), callback=None, parent=None, build_dimensions=None, circular_platform=False, simarrange_path=None, antialias_samples=0): super(StlPlater, self).__init__(filenames, size, callback, parent, build_dimensions) self.cutting = False self.cutting_axis = None self.cutting_dist = None if glview: viewer = stlview.StlViewPanel( self, (580, 580), build_dimensions=self.build_dimensions, circular=circular_platform, antialias_samples=antialias_samples) # Cutting tool nrows = self.menusizer.GetRows() self.menusizer.Add(wx.StaticText(self.menupanel, -1, _("Cut along:")), pos=(nrows, 0), span=(1, 1), flag=wx.ALIGN_CENTER) cutconfirmbutton = wx.Button(self.menupanel, label=_("Confirm cut")) cutconfirmbutton.Bind(wx.EVT_BUTTON, self.cut_confirm) cutconfirmbutton.Disable() self.cutconfirmbutton = cutconfirmbutton self.menusizer.Add(cutconfirmbutton, pos=(nrows, 1), span=(1, 1), flag=wx.EXPAND) cutpanel = wx.Panel(self.menupanel, -1) cutsizer = self.cutsizer = wx.BoxSizer(wx.HORIZONTAL) cutpanel.SetSizer(cutsizer) cutxplusbutton = wx.ToggleButton(cutpanel, label=_(">X"), style=wx.BU_EXACTFIT) cutxplusbutton.Bind( wx.EVT_TOGGLEBUTTON, lambda event: self.start_cutting_tool(event, "x", 1)) cutsizer.Add(cutxplusbutton, 1, flag=wx.EXPAND) cutzplusbutton = wx.ToggleButton(cutpanel, label=_(">Y"), style=wx.BU_EXACTFIT) cutzplusbutton.Bind( wx.EVT_TOGGLEBUTTON, lambda event: self.start_cutting_tool(event, "y", 1)) cutsizer.Add(cutzplusbutton, 1, flag=wx.EXPAND) cutzplusbutton = wx.ToggleButton(cutpanel, label=_(">Z"), style=wx.BU_EXACTFIT) cutzplusbutton.Bind( wx.EVT_TOGGLEBUTTON, lambda event: self.start_cutting_tool(event, "z", 1)) cutsizer.Add(cutzplusbutton, 1, flag=wx.EXPAND) cutxminusbutton = wx.ToggleButton(cutpanel, label=_("<X"), style=wx.BU_EXACTFIT) cutxminusbutton.Bind( wx.EVT_TOGGLEBUTTON, lambda event: self.start_cutting_tool(event, "x", -1)) cutsizer.Add(cutxminusbutton, 1, flag=wx.EXPAND) cutzminusbutton = wx.ToggleButton(cutpanel, label=_("<Y"), style=wx.BU_EXACTFIT) cutzminusbutton.Bind( wx.EVT_TOGGLEBUTTON, lambda event: self.start_cutting_tool(event, "y", -1)) cutsizer.Add(cutzminusbutton, 1, flag=wx.EXPAND) cutzminusbutton = wx.ToggleButton(cutpanel, label=_("<Z"), style=wx.BU_EXACTFIT) cutzminusbutton.Bind( wx.EVT_TOGGLEBUTTON, lambda event: self.start_cutting_tool(event, "z", -1)) cutsizer.Add(cutzminusbutton, 1, flag=wx.EXPAND) self.menusizer.Add(cutpanel, pos=(nrows + 1, 0), span=(1, 2), flag=wx.EXPAND) else: viewer = showstl(self, (580, 580), (0, 0)) self.simarrange_path = simarrange_path if simarrange_path else "./simarrange/sa" self.set_viewer(viewer)
def __init__(self, *args, **kw): # ensure the parent's __init__ is called super(MainFrame, self).__init__(*args, style=wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER) # create a panel in the frame self.panel = scrolled.ScrolledPanel(self, -1, size=(wx.DisplaySize())) # Button plot self.vbox = wx.BoxSizer(wx.VERTICAL) # Mode selection self.tbtn = wx.ToggleButton(self.panel, -1, "Event mode") self.vbox.Add(self.tbtn, 0, wx.EXPAND | wx.ALIGN_CENTER) self.tbtn.Bind(wx.EVT_TOGGLEBUTTON, self.on_toggle) # Title self.st = wx.StaticText(self.panel, label="Enter data") font = self.st.GetFont() font.PointSize += 2 font = font.Bold() self.st.SetFont(font) self.vbox.Add(self.st, 0, wx.ALIGN_CENTER) # Labels events hbox_labels = wx.BoxSizer(wx.HORIZONTAL) activity_label = wx.StaticText(self.panel, -1, label="Activity", size=(80, -1)) time_label = wx.StaticText(self.panel, -1, label="Time", size=(80, -1)) succession_label = wx.StaticText(self.panel, -1, "Succession of events", size=(135, -1)) add_label = wx.StaticText(self.panel, -1, "Add", size=(30, -1)) hbox_labels.Add(activity_label, 0, wx.EXPAND | wx.ALIGN_LEFT | wx.ALL, 5) hbox_labels.Add(time_label, 0, wx.EXPAND | wx.ALIGN_LEFT | wx.ALL, 5) hbox_labels.Add(succession_label, 0, wx.EXPAND | wx.ALIGN_LEFT | wx.ALL, 5) hbox_labels.Add(add_label, 0, wx.ALIGN_RIGHT | wx.ALL, 5) self.vbox.Add(hbox_labels) # Input events hbox_input = wx.BoxSizer(wx.HORIZONTAL) self.btn_add_e = wx.Button(self.panel, -1, "+", size=(30, -1)) self.activity_input_e = wx.TextCtrl(self.panel, -1, size=(80, -1)) self.time_input_e = wx.TextCtrl(self.panel, -1, size=(80, -1)) self.A_input_e = wx.TextCtrl(self.panel, -1, size=(50, -1)) self.B_input_e = wx.TextCtrl(self.panel, -1, size=(50, -1)) hbox_input.Add(self.activity_input_e, 0, wx.EXPAND | wx.ALIGN_LEFT | wx.ALL, 5) hbox_input.Add(self.time_input_e, 0, wx.EXPAND | wx.ALIGN_LEFT | wx.ALL, 5) hbox_input.Add(self.A_input_e, 0, wx.EXPAND | wx.ALIGN_LEFT | wx.ALL, 5) hbox_input.Add(wx.StaticText(self.panel, -1, "->"), 0, wx.EXPAND | wx.ALIGN_LEFT | wx.ALL, 5) hbox_input.Add(self.B_input_e, 0, wx.EXPAND | wx.ALIGN_LEFT | wx.ALL, 5) hbox_input.Add(self.btn_add_e, 0, wx.EXPAND | wx.ALIGN_LEFT | wx.ALL, 5) self.vbox.Add(hbox_input) self.input_event = [] self.input_event.append(self.activity_input_e) self.input_event.append(self.time_input_e) self.input_event.append(self.A_input_e) self.input_event.append(self.B_input_e) # Labels actions hbox_labels = wx.BoxSizer(wx.HORIZONTAL) activity_label = wx.StaticText(self.panel, -1, label="Activity", size=(80, -1)) time_label = wx.StaticText(self.panel, -1, label="Time", size=(80, -1)) succession_label = wx.StaticText(self.panel, -1, "Previous activity", size=(135, -1)) add_label = wx.StaticText(self.panel, -1, "Add", size=(30, -1)) hbox_labels.Add(activity_label, 0, wx.EXPAND | wx.ALIGN_LEFT | wx.ALL, 5) hbox_labels.Add(time_label, 0, wx.EXPAND | wx.ALIGN_LEFT | wx.ALL, 5) hbox_labels.Add(succession_label, 0, wx.EXPAND | wx.ALIGN_LEFT | wx.ALL, 5) hbox_labels.Add(add_label, 0, wx.ALIGN_RIGHT | wx.ALL, 5) self.vbox.Add(hbox_labels) # Input actions hbox_input = wx.BoxSizer(wx.HORIZONTAL) self.btn_add_a = wx.Button(self.panel, -1, "+", size=(30, -1)) self.activity_input_a = wx.TextCtrl(self.panel, -1, size=(80, -1)) self.time_input_a = wx.TextCtrl(self.panel, -1, size=(80, -1)) self.input_a = wx.TextCtrl(self.panel, -1, size=(133, -1)) hbox_input.Add(self.activity_input_a, 0, wx.EXPAND | wx.ALIGN_LEFT | wx.ALL, 5) hbox_input.Add(self.time_input_a, 0, wx.EXPAND | wx.ALIGN_LEFT | wx.ALL, 5) hbox_input.Add(self.input_a, 0, wx.EXPAND | wx.ALIGN_LEFT | wx.ALL, 5) hbox_input.Add(self.btn_add_a, 0, wx.EXPAND | wx.ALIGN_LEFT | wx.ALL, 5) self.vbox.Add(hbox_input) self.input_action = [] self.input_action.append(self.activity_input_a) self.input_action.append(self.time_input_a) self.input_action.append(self.input_a) for inp in self.input_action: inp.SetEditable(False) inp.SetBackgroundColour((50, 50, 50)) # Buttons self.btn_add_e.Bind(wx.EVT_BUTTON, self.on_add_by_events_clicked) self.btn_add_a.Bind(wx.EVT_BUTTON, self.on_add_by_actions_clicked) self.data = [] self.is_loaded_as_events = True self.make_menu_bar() self.panel.SetSizer(self.vbox) self.CreateStatusBar() self.SetStatusText("Welcome to operational research application!") self.Centre() self.Show() self.Fit()
def __init__(self, parent, *args): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u'视频解析器', pos=wx.DefaultPosition, size=wx.Size(420, 460), style=wx.DEFAULT_DIALOG_STYLE) self.SetBackgroundColour(wx.Colour(240, 240, 240)) text_resolution = wx.StaticText(self, wx.ID_ANY, u"Quality:", wx.DefaultPosition, wx.DefaultSize, 0) text_resolution.Wrap(-1) self.checkbox_1 = wx.ToggleButton(self, wx.ID_ANY, u"1", wx.DefaultPosition, wx.Size(40, 20), 0) self.checkbox_2 = wx.ToggleButton(self, wx.ID_ANY, u"2", wx.DefaultPosition, wx.Size(40, 20), 0) self.checkbox_3 = wx.ToggleButton(self, wx.ID_ANY, u"3", wx.DefaultPosition, wx.Size(40, 20), 0) self.checkbox_4 = wx.ToggleButton(self, wx.ID_ANY, u"4", wx.DefaultPosition, wx.Size(40, 20), 0) self.checkbox_5 = wx.ToggleButton(self, wx.ID_ANY, u"5", wx.DefaultPosition, wx.Size(40, 20), 0) self.checkbox_6 = wx.ToggleButton(self, wx.ID_ANY, u"6", wx.DefaultPosition, wx.Size(40, 20), 0) # self.checkbox_700 = wx.CheckBox(self, wx.ID_ANY, u"600", wx.DefaultPosition, wx.DefaultSize, 0) # self.checkbox_800 = wx.CheckBox(self, wx.ID_ANY, u"600", wx.DefaultPosition, wx.DefaultSize, 0) # self.checkbox_1.SetValue(True) # self.checkbox_2.SetValue(True) # self.checkbox_3.SetValue(True) # self.checkbox_4.SetValue(True) # self.checkbox_5.SetValue(True) self.checkbox_6.SetValue(True) sizer_resolution = wx.BoxSizer(wx.HORIZONTAL) sizer_resolution.Add(text_resolution, 0, wx.ALL, 5) sizer_resolution.Add(self.checkbox_1, wx.EXPAND, wx.ALIGN_CENTER | wx.ALL, 0) sizer_resolution.Add(self.checkbox_2, wx.EXPAND, wx.ALIGN_CENTER | wx.ALL, 0) sizer_resolution.Add(self.checkbox_3, wx.EXPAND, wx.ALIGN_CENTER | wx.ALL, 0) sizer_resolution.Add(self.checkbox_4, wx.EXPAND, wx.ALIGN_CENTER | wx.ALL, 0) sizer_resolution.Add(self.checkbox_5, wx.EXPAND, wx.ALIGN_CENTER | wx.ALL, 0) sizer_resolution.Add(self.checkbox_6, wx.EXPAND, wx.ALIGN_CENTER | wx.ALL, 0) staticline1 = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) staticline2 = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) staticline4 = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) # staticline3 = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) text_url = wx.StaticText(self, wx.ID_ANY, u"Url", wx.DefaultPosition, wx.DefaultSize, 0) text_url.Wrap(-1) self.textctrl_url = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) self.button_parse = wx.Button(self, wx.ID_ANY, u"解析", wx.DefaultPosition, wx.Size(80, -1), 0) # self.button_parse.Connect(-1, -1, ID_BUTTON_PARSE_EVENT, self.button_parse_retrycounter) sizer_url = wx.BoxSizer(wx.HORIZONTAL) sizer_url.Add(text_url, 0, wx.ALIGN_CENTER | wx.ALL, 5) sizer_url.Add(self.textctrl_url, 5, wx.ALIGN_CENTER | wx.ALL, 2) sizer_url.Add(self.button_parse, 0, wx.ALIGN_CENTER | wx.ALL, 2) # ================================================================= self.listctrl_parse = ListCtrl_Parser(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LC_REPORT) sizer_listctrl = wx.BoxSizer(wx.VERTICAL) sizer_listctrl.Add(self.listctrl_parse, 1, wx.ALL | wx.EXPAND, 5) # ================================================================= # self.button_copyurl = wx.Button(self, wx.ID_ANY, u"复制下载链接", wx.DefaultPosition, wx.DefaultSize, 0) # self.button_godownload = wx.Button(self, wx.ID_ANY, u"下载选中项", wx.DefaultPosition, wx.DefaultSize, 0) # self.button_godownload.Enable(False) # sizer_control = wx.BoxSizer(wx.HORIZONTAL) # sizer_control.Add(self.button_copyurl, 0, wx.ALL, 5) # sizer_control.Add(self.button_godownload, 1, wx.ALIGN_RIGHT | wx.ALL, 5) # ================================================================= # text_path = wx.StaticText(self, wx.ID_ANY, u"PATH:", wx.DefaultPosition, wx.DefaultSize, 0) # text_path.Wrap(-1) # self.textctrl_path = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) # self.button_path = wx.Button(self, wx.ID_ANY, u"...", wx.DefaultPosition, wx.Size(50, -1), 0) # sizer_path = wx.BoxSizer(wx.HORIZONTAL) # sizer_path.Add(text_path, 0, wx.ALIGN_CENTER | wx.ALL, 2) # sizer_path.Add(self.textctrl_path, 1, wx.ALIGN_CENTER | wx.ALL, 2) # sizer_path.Add(self.button_path, 0, wx.ALIGN_CENTER | wx.ALL, 2) sizer_global = wx.BoxSizer(wx.VERTICAL) # sizer_global.Add(staticline1, 0, wx.EXPAND | wx.ALL, 3) sizer_global.Add(sizer_url, 0, wx.EXPAND, 3) sizer_global.Add(staticline2, 0, wx.EXPAND | wx.ALL, 3) sizer_global.Add(sizer_listctrl, 1, wx.EXPAND, 3) # sizer_global.Add(staticline3, 0, wx.EXPAND | wx.ALL, 3) # sizer_global.Add(sizer_control, 0, wx.EXPAND, 2) sizer_global.Add(staticline4, 0, wx.EXPAND | wx.ALL, 3) sizer_global.Add(sizer_resolution, 0, wx.EXPAND, 3) # sizer_global.Add(sizer_path, 0, wx.EXPAND, 0) self.menu_bar = ParserMenuBar(0) self.SetMenuBar(self.menu_bar) self.SetSizer(sizer_global) self.Layout() self.Centre(wx.BOTH)
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) # Find out what devices we have to work with. lightToggles = depot.getHandlersOfType(depot.LIGHT_TOGGLE) ## Maps LightSource handlers to their associated panels of controls. self.lightToPanel = dict() # Construct the UI. # Sizer for all controls. We'll split them into bottom half (light # sources) and top half (everything else). self.Sizer = wx.BoxSizer(wx.VERTICAL) # Panel for holding the non-lightsource controls. topPanel = wx.Panel(self) self.topPanel = topPanel topSizer = wx.BoxSizer(wx.VERTICAL) # A row of buttons for various actions we know we can take. buttonSizer = wx.BoxSizer(wx.HORIZONTAL) # Abort button abortButton = wx.Button(topPanel, wx.ID_ANY, "abort") abortButton.SetLabelMarkup( "<span foreground='red'><big><b>ABORT</b></big></span>") abortButton.Bind(wx.EVT_BUTTON, lambda event: events.publish(events.USER_ABORT)) buttonSizer.Add(abortButton, 1, wx.EXPAND) # Experiment & review buttons for lbl, fn in (("Single-site\nexperiment", lambda evt: singleSiteExperiment.showDialog(self)), ("Multi-site\nexperiment", lambda evt: multiSiteExperiment.showDialog(self)), ("View last\nfile", self.onViewLastFile)): btn = wx.Button(topPanel, wx.ID_ANY, lbl) btn.Bind(wx.EVT_BUTTON, fn) buttonSizer.Add(btn, 1, wx.EXPAND) # Video mode button videoButton = wx.ToggleButton(topPanel, wx.ID_ANY, "Live") videoButton.Bind(wx.EVT_TOGGLEBUTTON, lambda evt: cockpit.interfaces.imager.videoMode()) events.subscribe(cockpit.events.VIDEO_MODE_TOGGLE, lambda state: videoButton.SetValue(state)) buttonSizer.Add(videoButton, 1, wx.EXPAND) # Snap image button snapButton = wx.Button(topPanel, wx.ID_ANY, "Snap\nimage") snapButton.Bind( wx.EVT_BUTTON, lambda evt: cockpit.interfaces.imager.imager.takeImage()) buttonSizer.Add(snapButton, 1, wx.EXPAND) # Increase font size in top row buttons. for w in [child.GetWindow() for child in buttonSizer.Children]: w.SetFont(w.GetFont().Larger()) topSizer.Add(buttonSizer) topSizer.AddSpacer(ROW_SPACER) # Make UIs for any other handlers / devices and insert them into # our window, if possible. # Light power things will be handled later. lightPowerThings = depot.getHandlersOfType(depot.LIGHT_POWER) lightPowerThings.sort(key=lambda l: l.wavelength) # Camera UIs are drawn seperately. Currently, they are drawn first, # but this separation may make it easier to implement cameras in # ordered slots, giving the user control over exposure order. cameraThings = depot.getHandlersOfType(depot.CAMERA) # Ignore anything that is handled specially. ignoreThings = lightToggles + lightPowerThings ignoreThings += cameraThings # Remove ignoreThings from the full list of devices. otherThings = list(depot.getAllDevices()) otherThings.sort(key=lambda d: d.__class__.__name__) otherThings.extend(depot.getAllHandlers()) rowSizer = wx.WrapSizer(wx.HORIZONTAL) # Add objective control # If only one objective device (usual), add to end of top row, # otherwise add to start of 2nd row. hs = depot.getHandlersOfType(depot.OBJECTIVE) if len(hs) == 1: buttonSizer.Add(mainPanels.ObjectiveControls(self.topPanel), flag=wx.LEFT, border=2) else: rowSizer.Add(mainPanels.ObjectiveControls(self.topPanel), flag=wx.EXPAND) rowSizer.AddSpacer(COL_SPACER) ignoreThings.extend(hs) # Make the UI elements for the cameras. rowSizer.Add(mainPanels.CameraControlsPanel(self.topPanel), flag=wx.EXPAND) rowSizer.AddSpacer(COL_SPACER) # Add light controls. lightfilters = sorted(depot.getHandlersOfType(depot.LIGHT_FILTER)) ignoreThings.extend(lightfilters) # Add filterwheel controls. rowSizer.Add(mainPanels.FilterControls(self.topPanel), flag=wx.EXPAND) # Make the UI elements for eveything else. for thing in ignoreThings: if thing in otherThings: otherThings.remove(thing) for thing in sorted(otherThings): if depot.getHandler(thing, depot.CAMERA): # Camera UIs already drawn. continue item = thing.makeUI(topPanel) if item is not None: itemsizer = wx.BoxSizer(wx.VERTICAL) itemsizer.Add( cockpit.gui.mainPanels.PanelLabel(topPanel, thing.name)) itemsizer.Add(item, 1, wx.EXPAND) if rowSizer.GetChildren(): # Add a spacer. rowSizer.AddSpacer(COL_SPACER) rowSizer.Add(itemsizer, flag=wx.EXPAND) topSizer.Add(rowSizer) topPanel.SetSizerAndFit(topSizer) self.Sizer.Add(topPanel, flag=wx.EXPAND) self.Sizer.AddSpacer(ROW_SPACER) ## Panel for holding light sources. self.Sizer.Add(mainPanels.LightControlsPanel(self), flag=wx.EXPAND) keyboard.setKeyboardHandlers(self) self.joystick = joystick.Joystick(self) self.SetDropTarget(viewFileDropTarget.ViewFileDropTarget(self)) # Show the list of windows on right-click. self.Bind(wx.EVT_CONTEXT_MENU, lambda event: keyboard.martialWindows(self))
def __init__(self, parent, *args, context=None, node=None, **kwds): kwds["style"] = kwds.get("style", 0) | wx.TAB_TRAVERSAL super().__init__(parent, *args, **kwds) self.context = context self.text_id = wx.TextCtrl(self, wx.ID_ANY, "") self.text_label = wx.TextCtrl(self, wx.ID_ANY, "") self.text_text = wx.TextCtrl(self, wx.ID_ANY, "") self.node = node self.label_fonttest = wx.StaticText(self, wx.ID_ANY, "", style=wx.ST_ELLIPSIZE_END | wx.ST_NO_AUTORESIZE) self.label_fonttest.SetMinSize((-1, 90)) self.label_fonttest.SetFont( wx.Font( 16, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, 0, "Segoe UI", )) self.button_choose_font = wx.BitmapButton( self, wx.ID_ANY, icons8_choose_font_50.GetBitmap()) self.button_stroke_none = wx.Button(self, wx.ID_ANY, "None") self.button_stroke_none.name = "stroke none" self.button_stroke_F00 = wx.Button(self, wx.ID_ANY, "") self.button_stroke_F00.name = "stroke #F00" self.button_stroke_0F0 = wx.Button(self, wx.ID_ANY, "") self.button_stroke_0F0.name = "stroke #0F0" self.button_stroke_00F = wx.Button(self, wx.ID_ANY, "") self.button_stroke_00F.name = "stroke #00F" self.button_stroke_F0F = wx.Button(self, wx.ID_ANY, "") self.button_stroke_F0F.name = "stroke #F0F" self.button_stroke_0FF = wx.Button(self, wx.ID_ANY, "") self.button_stroke_0FF.name = "stroke #0FF" self.button_stroke_FF0 = wx.Button(self, wx.ID_ANY, "") self.button_stroke_FF0.name = "stroke #FF0" self.button_stroke_000 = wx.Button(self, wx.ID_ANY, "") self.button_stroke_000.name = "stroke #000" self.button_fill_none = wx.Button(self, wx.ID_ANY, "None") self.button_fill_none.name = "fill none" self.button_fill_F00 = wx.Button(self, wx.ID_ANY, "") self.button_fill_F00.name = "fill #F00" self.button_fill_0F0 = wx.Button(self, wx.ID_ANY, "") self.button_fill_0F0.name = "fill #0F0" self.button_fill_00F = wx.Button(self, wx.ID_ANY, "") self.button_fill_00F.name = "fill #00F" self.button_fill_F0F = wx.Button(self, wx.ID_ANY, "") self.button_fill_F0F.name = "fill #F0F" self.button_fill_0FF = wx.Button(self, wx.ID_ANY, "") self.button_fill_0FF.name = "fill #0FF" self.button_fill_FF0 = wx.Button(self, wx.ID_ANY, "") self.button_fill_FF0.name = "fill #FF0" self.button_fill_000 = wx.Button(self, wx.ID_ANY, "") self.button_fill_000.name = "fill #000" flist = wx.FontEnumerator() flist.EnumerateFacenames() elist = flist.GetFacenames() elist.sort() self.combo_font = PromptingComboBox(self, choices=elist, style=wx.TE_PROCESS_ENTER) self.button_attrib_larger = wx.Button(self, id=wx.ID_ANY, label="A", size=wx.Size(23, 23)) self.button_attrib_smaller = wx.Button(self, id=wx.ID_ANY, label="a", size=wx.Size(23, 23)) self.button_attrib_bold = wx.ToggleButton(self, id=wx.ID_ANY, label="b", size=wx.Size(23, 23)) self.button_attrib_italic = wx.ToggleButton(self, id=wx.ID_ANY, label="i", size=wx.Size(23, 23)) self.button_attrib_underline = wx.ToggleButton(self, id=wx.ID_ANY, label="u", size=wx.Size(23, 23)) self.button_attrib_strikethrough = wx.ToggleButton(self, id=wx.ID_ANY, label="s", size=wx.Size( 23, 23)) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_TEXT, self.on_text_id_change, self.text_id) self.Bind(wx.EVT_TEXT_ENTER, self.on_text_id_change, self.text_id) self.Bind(wx.EVT_TEXT, self.on_text_label_change, self.text_label) self.Bind(wx.EVT_TEXT_ENTER, self.on_text_label_change, self.text_label) self.Bind(wx.EVT_TEXT, self.on_text_name_change, self.text_text) self.Bind(wx.EVT_TEXT_ENTER, self.on_text_name_change, self.text_text) self.Bind(wx.EVT_BUTTON, self.on_button_choose_font, self.button_choose_font) self.Bind(wx.EVT_BUTTON, self.on_button_color, self.button_stroke_none) self.Bind(wx.EVT_BUTTON, self.on_button_color, self.button_stroke_F00) self.Bind(wx.EVT_BUTTON, self.on_button_color, self.button_stroke_0F0) self.Bind(wx.EVT_BUTTON, self.on_button_color, self.button_stroke_00F) self.Bind(wx.EVT_BUTTON, self.on_button_color, self.button_stroke_F0F) self.Bind(wx.EVT_BUTTON, self.on_button_color, self.button_stroke_0FF) self.Bind(wx.EVT_BUTTON, self.on_button_color, self.button_stroke_FF0) self.Bind(wx.EVT_BUTTON, self.on_button_color, self.button_stroke_000) self.Bind(wx.EVT_BUTTON, self.on_button_color, self.button_fill_none) self.Bind(wx.EVT_BUTTON, self.on_button_color, self.button_fill_F00) self.Bind(wx.EVT_BUTTON, self.on_button_color, self.button_fill_0F0) self.Bind(wx.EVT_BUTTON, self.on_button_color, self.button_fill_00F) self.Bind(wx.EVT_BUTTON, self.on_button_color, self.button_fill_F0F) self.Bind(wx.EVT_BUTTON, self.on_button_color, self.button_fill_0FF) self.Bind(wx.EVT_BUTTON, self.on_button_color, self.button_fill_FF0) self.Bind(wx.EVT_BUTTON, self.on_button_color, self.button_fill_000) self.Bind(wx.EVT_COMBOBOX, self.on_font_choice, self.combo_font) self.Bind(wx.EVT_TEXT_ENTER, self.on_font_choice, self.combo_font) self.Bind(wx.EVT_KILL_FOCUS, self.on_font_choice, self.combo_font) self.Bind(wx.EVT_BUTTON, self.on_button_larger, self.button_attrib_larger) self.Bind(wx.EVT_BUTTON, self.on_button_smaller, self.button_attrib_smaller) self.Bind(wx.EVT_TOGGLEBUTTON, self.on_button_bold, self.button_attrib_bold) self.Bind(wx.EVT_TOGGLEBUTTON, self.on_button_italic, self.button_attrib_italic) self.Bind(wx.EVT_TOGGLEBUTTON, self.on_button_underline, self.button_attrib_underline) self.Bind( wx.EVT_TOGGLEBUTTON, self.on_button_strikethrough, self.button_attrib_strikethrough, )
def __init__(self, parent, config, imtypes, config3d, sourceCam, jump_unlabeled): super(MainFrame, self).__init__("DeepLabCut2.0 - Labeling ToolBox", parent, imtypes) self.jump_unlabeled = jump_unlabeled self.statusbar.SetStatusText( "Looking for a folder to start labeling. Click 'Load frames' to begin." ) self.Bind(wx.EVT_CHAR_HOOK, self.OnKeyPressed) ################################################################################################################################################### # Splitting the frame into top and bottom panels. Bottom panels contains the widgets. The top panel is for showing images and plotting! topSplitter = wx.SplitterWindow(self) vSplitter = wx.SplitterWindow(topSplitter) self.image_panel = ImagePanel(vSplitter, config, config3d, sourceCam, self.gui_size) self.choice_panel = ScrollPanel(vSplitter) vSplitter.SplitVertically(self.image_panel, self.choice_panel, sashPosition=self.gui_size[0] * 0.8) vSplitter.SetSashGravity(1) self.widget_panel = WidgetPanel(topSplitter) topSplitter.SplitHorizontally(vSplitter, self.widget_panel, sashPosition=self.gui_size[1] * 0.83) # 0.9 topSplitter.SetSashGravity(1) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(topSplitter, 1, wx.EXPAND) self.SetSizer(sizer) ################################################################################################################################################### # Add Buttons to the WidgetPanel and bind them to their respective functions. widgetsizer = wx.WrapSizer(orient=wx.HORIZONTAL) self.load = wx.Button(self.widget_panel, id=wx.ID_ANY, label="Load frames") widgetsizer.Add(self.load, 1, wx.ALL, 15) self.load.Bind(wx.EVT_BUTTON, self.browseDir) self.prev = wx.Button(self.widget_panel, id=wx.ID_ANY, label="<<Previous") widgetsizer.Add(self.prev, 1, wx.ALL, 15) self.prev.Bind(wx.EVT_BUTTON, self.prevImage) self.prev.Enable(False) self.next = wx.Button(self.widget_panel, id=wx.ID_ANY, label="Next>>") widgetsizer.Add(self.next, 1, wx.ALL, 15) self.next.Bind(wx.EVT_BUTTON, self.nextImage) self.next.Enable(False) self.help = wx.Button(self.widget_panel, id=wx.ID_ANY, label="Help") widgetsizer.Add(self.help, 1, wx.ALL, 15) self.help.Bind(wx.EVT_BUTTON, self.helpButton) self.help.Enable(True) # self.zoom = wx.ToggleButton(self.widget_panel, label="Zoom") widgetsizer.Add(self.zoom, 1, wx.ALL, 15) self.zoom.Bind(wx.EVT_TOGGLEBUTTON, self.zoomButton) self.widget_panel.SetSizer(widgetsizer) self.zoom.Enable(False) self.home = wx.Button(self.widget_panel, id=wx.ID_ANY, label="Home") widgetsizer.Add(self.home, 1, wx.ALL, 15) self.home.Bind(wx.EVT_BUTTON, self.homeButton) self.widget_panel.SetSizer(widgetsizer) self.home.Enable(False) self.pan = wx.ToggleButton(self.widget_panel, id=wx.ID_ANY, label="Pan") widgetsizer.Add(self.pan, 1, wx.ALL, 15) self.pan.Bind(wx.EVT_TOGGLEBUTTON, self.panButton) self.widget_panel.SetSizer(widgetsizer) self.pan.Enable(False) self.lock = wx.CheckBox(self.widget_panel, id=wx.ID_ANY, label="Lock View") widgetsizer.Add(self.lock, 1, wx.ALL, 15) self.lock.Bind(wx.EVT_CHECKBOX, self.lockChecked) self.widget_panel.SetSizer(widgetsizer) self.lock.Enable(False) self.save = wx.Button(self.widget_panel, id=wx.ID_ANY, label="Save") widgetsizer.Add(self.save, 1, wx.ALL, 15) self.save.Bind(wx.EVT_BUTTON, self.saveDataSet) self.save.Enable(False) widgetsizer.AddStretchSpacer(15) self.quit = wx.Button(self.widget_panel, id=wx.ID_ANY, label="Quit") widgetsizer.Add(self.quit, 1, wx.ALL, 15) self.quit.Bind(wx.EVT_BUTTON, self.quitButton) self.widget_panel.SetSizer(widgetsizer) self.widget_panel.SetSizerAndFit(widgetsizer) self.widget_panel.Layout() ############################################################################################################################### # Variables initialization self.currentDirectory = os.getcwd() self.index = [] self.iter = [] self.file = 0 self.updatedCoords = [] self.dataFrame = None self.config_file = config self.new_labels = False self.buttonCounter = [] self.bodyparts2plot = [] self.drs = [] self.num = [] self.view_locked = False # Workaround for MAC - xlim and ylim changed events seem to be triggered too often so need to make sure that the # xlim and ylim have actually changed before turning zoom off self.prezoom_xlim = [] self.prezoom_ylim = []
def __init__(self, *args, **kwds): # begin wxGlade: All_Widgets_Frame.__init__ kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.SetSize((800, 417)) # Menu Bar self.All_Widgets_menubar = wx.MenuBar() global mn_IDUnix; mn_IDUnix = wx.NewId() global mn_IDWindows; mn_IDWindows = wx.NewId() wxglade_tmp_menu = wx.Menu() wxglade_tmp_menu.Append(wx.ID_OPEN, _("&Open"), _("Open an existing document")) wxglade_tmp_menu.Append(wx.ID_CLOSE, _("&Close file"), _("Close current document")) wxglade_tmp_menu.AppendSeparator() wxglade_tmp_menu.Append(wx.ID_EXIT, _("E&xit"), _("Finish program")) self.All_Widgets_menubar.Append(wxglade_tmp_menu, _("&File")) wxglade_tmp_menu = wx.Menu() self.All_Widgets_menubar.mn_Unix = wxglade_tmp_menu.Append(mn_IDUnix, _("Unix"), _("Use Unix line endings"), wx.ITEM_RADIO) self.Bind(wx.EVT_MENU, self.onSelectUnix, id=mn_IDUnix) self.All_Widgets_menubar.mn_Windows = wxglade_tmp_menu.Append(mn_IDWindows, _("Windows"), _("Use Windows line endings"), wx.ITEM_RADIO) self.Bind(wx.EVT_MENU, self.onSelectWindows, id=mn_IDWindows) wxglade_tmp_menu.AppendSeparator() self.All_Widgets_menubar.mn_RemoveTabs = wxglade_tmp_menu.Append(wx.ID_ANY, _("Remove Tabs"), _("Remove all leading tabs"), wx.ITEM_CHECK) self.Bind(wx.EVT_MENU, self.onRemoveTabs, id=self.All_Widgets_menubar.mn_RemoveTabs.GetId()) self.All_Widgets_menubar.Append(wxglade_tmp_menu, _("&Edit")) wxglade_tmp_menu = wx.Menu() wxglade_tmp_menu.Append(wx.ID_HELP, _("Manual"), _("Show the application manual")) self.Bind(wx.EVT_MENU, self.onShowManual, id=wx.ID_HELP) wxglade_tmp_menu.AppendSeparator() wxglade_tmp_menu.Append(wx.ID_ABOUT, _("About"), _("Show the About dialog")) self.All_Widgets_menubar.Append(wxglade_tmp_menu, _("&Help")) self.SetMenuBar(self.All_Widgets_menubar) # Menu Bar end self.All_Widgets_statusbar = self.CreateStatusBar(1, wx.ST_SIZEGRIP) # Tool Bar self.All_Widgets_toolbar = wx.ToolBar(self, -1) self.SetToolBar(self.All_Widgets_toolbar) self.All_Widgets_toolbar.AddLabelTool(wx.ID_UP, _("UpDown"), wx.ArtProvider.GetBitmap(wx.ART_GO_UP, wx.ART_OTHER, (32, 32)), wx.ArtProvider.GetBitmap(wx.ART_GO_DOWN, wx.ART_OTHER, (32, 32)), wx.ITEM_CHECK, _("Up or Down"), _("Up or Down")) self.All_Widgets_toolbar.AddLabelTool(wx.ID_OPEN, _("Open"), wx.EmptyBitmap(32, 32), wx.NullBitmap, wx.ITEM_NORMAL, _("Open a new file"), _("Open a new file")) # Tool Bar end self.notebook_1 = wx.Notebook(self, wx.ID_ANY, style=wx.NB_BOTTOM) self.notebook_1_wxBitmapButton = wx.Panel(self.notebook_1, wx.ID_ANY) self.bitmap_button_icon1 = wx.BitmapButton(self.notebook_1_wxBitmapButton, wx.ID_ANY, wx.Bitmap("icon.xpm", wx.BITMAP_TYPE_ANY)) self.bitmap_button_empty1 = wx.BitmapButton(self.notebook_1_wxBitmapButton, wx.ID_ANY, wx.EmptyBitmap(10, 10)) self.bitmap_button_icon2 = wx.BitmapButton(self.notebook_1_wxBitmapButton, wx.ID_ANY, wx.Bitmap("icon.xpm", wx.BITMAP_TYPE_ANY), style=wx.BORDER_NONE | wx.BU_BOTTOM) self.bitmap_button_art = wx.BitmapButton(self.notebook_1_wxBitmapButton, wx.ID_ANY, wx.ArtProvider.GetBitmap(wx.ART_GO_UP, wx.ART_OTHER, (32, 32)), style=wx.BORDER_NONE | wx.BU_BOTTOM) self.notebook_1_wxButton = wx.Panel(self.notebook_1, wx.ID_ANY) self.button_3 = wx.Button(self.notebook_1_wxButton, wx.ID_BOLD, "") self.notebook_1_wxCalendarCtrl = wx.Panel(self.notebook_1, wx.ID_ANY) self.calendar_ctrl_1 = wx.calendar.CalendarCtrl(self.notebook_1_wxCalendarCtrl, wx.ID_ANY, style=wx.calendar.CAL_MONDAY_FIRST | wx.calendar.CAL_SEQUENTIAL_MONTH_SELECTION | wx.calendar.CAL_SHOW_SURROUNDING_WEEKS) self.notebook_1_wxCheckBox = wx.Panel(self.notebook_1, wx.ID_ANY) self.checkbox_1 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY, _("one (unchecked)")) self.checkbox_2 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY, _("two (checked)")) self.checkbox_3 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY, _("three"), style=wx.CHK_2STATE) self.checkbox_4 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY, _("four (unchecked)"), style=wx.CHK_3STATE) self.checkbox_5 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY, _("five (checked)"), style=wx.CHK_3STATE | wx.CHK_ALLOW_3RD_STATE_FOR_USER) self.checkbox_6 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY, _("six (undetermined)"), style=wx.CHK_3STATE | wx.CHK_ALLOW_3RD_STATE_FOR_USER) self.notebook_1_wxCheckListBox = wx.Panel(self.notebook_1, wx.ID_ANY) self.check_list_box_1 = wx.CheckListBox(self.notebook_1_wxCheckListBox, wx.ID_ANY, choices=[_("one"), _("two"), _("three"), _("four")]) self.notebook_1_wxChoice = wx.Panel(self.notebook_1, wx.ID_ANY) self.choice_empty = wx.Choice(self.notebook_1_wxChoice, wx.ID_ANY, choices=[]) self.choice_filled = wx.Choice(self.notebook_1_wxChoice, wx.ID_ANY, choices=[_("Item 1"), _("Item 2 (pre-selected)")]) self.notebook_1_wxComboBox = wx.Panel(self.notebook_1, wx.ID_ANY) self.combo_box_empty = wx.ComboBox(self.notebook_1_wxComboBox, wx.ID_ANY, choices=[], style=0) self.combo_box_filled = wx.ComboBox(self.notebook_1_wxComboBox, wx.ID_ANY, choices=[_("Item 1 (pre-selected)"), _("Item 2")], style=0) self.notebook_1_wxDatePickerCtrl = wx.Panel(self.notebook_1, wx.ID_ANY) self.datepicker_ctrl_1 = wx.DatePickerCtrl(self.notebook_1_wxDatePickerCtrl, wx.ID_ANY, style=wx.DP_SHOWCENTURY) self.notebook_1_wxGauge = wx.Panel(self.notebook_1, wx.ID_ANY) self.gauge_1 = wx.Gauge(self.notebook_1_wxGauge, wx.ID_ANY, 20) self.notebook_1_wxGrid = wx.Panel(self.notebook_1, wx.ID_ANY) self.grid_1 = wx.grid.Grid(self.notebook_1_wxGrid, wx.ID_ANY, size=(1, 1)) self.notebook_1_wxHyperlinkCtrl = wx.Panel(self.notebook_1, wx.ID_ANY) self.hyperlink_1 = wx.HyperlinkCtrl(self.notebook_1_wxHyperlinkCtrl, wx.ID_ANY, _("Homepage wxGlade"), _("http://wxglade.sf.net")) self.notebook_1_wxListBox = wx.Panel(self.notebook_1, wx.ID_ANY) self.list_box_empty = wx.ListBox(self.notebook_1_wxListBox, wx.ID_ANY, choices=[], style=0) self.list_box_filled = wx.ListBox(self.notebook_1_wxListBox, wx.ID_ANY, choices=[_("Item 1"), _("Item 2 (pre-selected)")], style=wx.LB_MULTIPLE | wx.LB_SORT) self.notebook_1_wxListCtrl = wx.Panel(self.notebook_1, wx.ID_ANY) self.list_ctrl_1 = wx.ListCtrl(self.notebook_1_wxListCtrl, wx.ID_ANY, style=wx.BORDER_SUNKEN | wx.LC_REPORT) self.notebook_1_wxRadioBox = wx.Panel(self.notebook_1, wx.ID_ANY) self.radio_box_empty1 = wx.RadioBox(self.notebook_1_wxRadioBox, wx.ID_ANY, _("radio_box_empty1"), choices=[""], majorDimension=1, style=wx.RA_SPECIFY_ROWS) self.radio_box_filled1 = wx.RadioBox(self.notebook_1_wxRadioBox, wx.ID_ANY, _("radio_box_filled1"), choices=[_("choice 1"), _("choice 2 (pre-selected)"), _("choice 3")], majorDimension=0, style=wx.RA_SPECIFY_ROWS) self.radio_box_empty2 = wx.RadioBox(self.notebook_1_wxRadioBox, wx.ID_ANY, _("radio_box_empty2"), choices=[""], majorDimension=1, style=wx.RA_SPECIFY_COLS) self.radio_box_filled2 = wx.RadioBox(self.notebook_1_wxRadioBox, wx.ID_ANY, _("radio_box_filled2"), choices=[_("choice 1"), _("choice 2 (pre-selected)")], majorDimension=0, style=wx.RA_SPECIFY_COLS) self.notebook_1_wxRadioButton = wx.Panel(self.notebook_1, wx.ID_ANY) self.radio_btn_1 = wx.RadioButton(self.notebook_1_wxRadioButton, wx.ID_ANY, _("Alice"), style=wx.RB_GROUP) self.text_ctrl_1 = wx.TextCtrl(self.notebook_1_wxRadioButton, wx.ID_ANY, "") self.radio_btn_2 = wx.RadioButton(self.notebook_1_wxRadioButton, wx.ID_ANY, _("Bob")) self.text_ctrl_2 = wx.TextCtrl(self.notebook_1_wxRadioButton, wx.ID_ANY, "") self.radio_btn_3 = wx.RadioButton(self.notebook_1_wxRadioButton, wx.ID_ANY, _("Malroy")) self.text_ctrl_3 = wx.TextCtrl(self.notebook_1_wxRadioButton, wx.ID_ANY, "") self.notebook_1_wxSlider = wx.Panel(self.notebook_1, wx.ID_ANY) self.slider_1 = wx.Slider(self.notebook_1_wxSlider, wx.ID_ANY, 5, 0, 10, style=0) self.notebook_1_wxSpinButton = wx.Panel(self.notebook_1, wx.ID_ANY) self.tc_spin_button = wx.TextCtrl(self.notebook_1_wxSpinButton, wx.ID_ANY, _("1"), style=wx.TE_RIGHT) self.spin_button = wx.SpinButton(self.notebook_1_wxSpinButton, wx.ID_ANY ) self.notebook_1_wxSpinCtrl = wx.Panel(self.notebook_1, wx.ID_ANY) self.spin_ctrl_1 = wx.SpinCtrl(self.notebook_1_wxSpinCtrl, wx.ID_ANY, "4", min=0, max=100, style=wx.SP_ARROW_KEYS | wx.TE_RIGHT) self.notebook_1_wxSplitterWindow_horizontal = wx.ScrolledWindow(self.notebook_1, wx.ID_ANY, style=wx.TAB_TRAVERSAL) self.splitter_1 = wx.SplitterWindow(self.notebook_1_wxSplitterWindow_horizontal, wx.ID_ANY, style=0) self.splitter_1_pane_1 = wx.Panel(self.splitter_1, wx.ID_ANY) self.label_top_pane = wx.StaticText(self.splitter_1_pane_1, wx.ID_ANY, _("top pane")) self.splitter_1_pane_2 = wx.Panel(self.splitter_1, wx.ID_ANY) self.label_buttom_pane = wx.StaticText(self.splitter_1_pane_2, wx.ID_ANY, _("bottom pane")) self.notebook_1_wxSplitterWindow_vertical = wx.ScrolledWindow(self.notebook_1, wx.ID_ANY, style=wx.TAB_TRAVERSAL) self.splitter_2 = wx.SplitterWindow(self.notebook_1_wxSplitterWindow_vertical, wx.ID_ANY, style=0) self.splitter_2_pane_1 = wx.Panel(self.splitter_2, wx.ID_ANY) self.label_left_pane = wx.StaticText(self.splitter_2_pane_1, wx.ID_ANY, _("left pane")) self.splitter_2_pane_2 = wx.Panel(self.splitter_2, wx.ID_ANY) self.label_right_pane = wx.StaticText(self.splitter_2_pane_2, wx.ID_ANY, _("right pane")) self.notebook_1_wxStaticBitmap = wx.Panel(self.notebook_1, wx.ID_ANY) self.bitmap_empty = wx.StaticBitmap(self.notebook_1_wxStaticBitmap, wx.ID_ANY, wx.EmptyBitmap(32, 32)) self.bitmap_file = wx.StaticBitmap(self.notebook_1_wxStaticBitmap, wx.ID_ANY, wx.Bitmap("icon.xpm", wx.BITMAP_TYPE_ANY)) self.bitmap_nofile = wx.StaticBitmap(self.notebook_1_wxStaticBitmap, wx.ID_ANY, wx.Bitmap("non-existing.bmp", wx.BITMAP_TYPE_ANY)) self.bitmap_art = wx.StaticBitmap(self.notebook_1_wxStaticBitmap, wx.ID_ANY, wx.ArtProvider.GetBitmap(wx.ART_PRINT, wx.ART_OTHER, (32, 32))) self.notebook_1_wxStaticLine = wx.Panel(self.notebook_1, wx.ID_ANY) self.static_line_2 = wx.StaticLine(self.notebook_1_wxStaticLine, wx.ID_ANY, style=wx.LI_VERTICAL) self.static_line_3 = wx.StaticLine(self.notebook_1_wxStaticLine, wx.ID_ANY, style=wx.LI_VERTICAL) self.static_line_4 = wx.StaticLine(self.notebook_1_wxStaticLine, wx.ID_ANY) self.static_line_5 = wx.StaticLine(self.notebook_1_wxStaticLine, wx.ID_ANY) self.notebook_1_wxStaticText = wx.Panel(self.notebook_1, wx.ID_ANY) self.label_1 = wx.StaticText(self.notebook_1_wxStaticText, wx.ID_ANY, _("red text (RGB)"), style=wx.ALIGN_CENTER) self.label_4 = wx.StaticText(self.notebook_1_wxStaticText, wx.ID_ANY, _("black on red (RGB)"), style=wx.ALIGN_CENTER) self.label_5 = wx.StaticText(self.notebook_1_wxStaticText, wx.ID_ANY, _("green on pink (RGB)"), style=wx.ALIGN_CENTER) self.notebook_1_Spacer = wx.Panel(self.notebook_1, wx.ID_ANY) self.label_3 = wx.StaticText(self.notebook_1_Spacer, wx.ID_ANY, _("Two labels with a")) self.label_2 = wx.StaticText(self.notebook_1_Spacer, wx.ID_ANY, _("spacer between")) self.notebook_1_wxTextCtrl = wx.Panel(self.notebook_1, wx.ID_ANY) self.text_ctrl = wx.TextCtrl(self.notebook_1_wxTextCtrl, wx.ID_ANY, _("This\nis\na\nmultiline\nwxTextCtrl"), style=wx.TE_CHARWRAP | wx.TE_MULTILINE | wx.TE_WORDWRAP) self.notebook_1_wxToggleButton = wx.Panel(self.notebook_1, wx.ID_ANY) self.button_2 = wx.ToggleButton(self.notebook_1_wxToggleButton, wx.ID_ANY, _("Toggle Button 1")) self.button_4 = wx.ToggleButton(self.notebook_1_wxToggleButton, wx.ID_ANY, _("Toggle Button 2"), style=wx.BU_BOTTOM | wx.BU_EXACTFIT) self.notebook_1_wxTreeCtrl = wx.Panel(self.notebook_1, wx.ID_ANY) self.tree_ctrl_1 = wx.TreeCtrl(self.notebook_1_wxTreeCtrl, wx.ID_ANY, style=0) self.static_line_1 = wx.StaticLine(self, wx.ID_ANY) self.button_5 = wx.Button(self, wx.ID_CLOSE, "") self.button_1 = wx.Button(self, wx.ID_OK, "", style=wx.BU_TOP) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.OnNotebookPageChanged, self.notebook_1) self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGING, self.OnNotebookPageChanging, self.notebook_1) self.Bind(wx.EVT_BUTTON, self.onStartConverting, self.button_1)