我们从Python开源项目中,提取了以下11个代码示例,用于说明如何使用wx.RadioBox()。
def __init__(self,parent): wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER) vbox = wx.BoxSizer(wx.VERTICAL) title = wx.StaticText(self, label="Numpy array with coordinates to VTK array") vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.input_filename = TextPanelObject(self, "Input file: ", "input.npy",150,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") vbox.Add(self.input_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) vbox.Add((-1, 5)) self.coords_filename = TextPanelObject(self, "Co-ord's file: ", "coordinates.npy",150,'*.npy') vbox.Add(self.coords_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) vbox.Add((-1, 5)) self.output_filename = TextPanelObject(self, "Output file: ", "output.vtk",150,"VTK files (*.vtk)|*.vtk|All files (*.*)|*.*") vbox.Add(self.output_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) vbox.Add((-1, 5)) self.rbampphase = wx.RadioBox(self, label="Type", choices=['Amplitude','Phase'], majorDimension=2, style=wx.RA_SPECIFY_COLS) vbox.Add(self.rbampphase,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.SetAutoLayout(True) self.SetSizer( vbox )
def __init__(self, *args, **kwds): self.settings = kwds['settings'] del kwds['settings'] # begin wxGlade: TerminalSettingsDialog.__init__ kwds["style"] = wx.DEFAULT_DIALOG_STYLE wx.Dialog.__init__(self, *args, **kwds) self.checkbox_echo = wx.CheckBox(self, -1, "Local Echo") self.checkbox_unprintable = wx.CheckBox(self, -1, "Show unprintable characters") self.radio_box_newline = wx.RadioBox(self, -1, "Newline Handling", choices=["CR only", "LF only", "CR+LF"], majorDimension=0, style=wx.RA_SPECIFY_ROWS) self.sizer_4_staticbox = wx.StaticBox(self, -1, "Input/Output") self.button_ok = wx.Button(self, wx.ID_OK, "") self.button_cancel = wx.Button(self, wx.ID_CANCEL, "") self.__set_properties() self.__do_layout() # end wxGlade self.__attach_events() self.checkbox_echo.SetValue(self.settings.echo) self.checkbox_unprintable.SetValue(self.settings.unprintable) self.radio_box_newline.SetSelection(self.settings.newline)
def __init__(self, *args, **kwds): self.settings = kwds['settings'] del kwds['settings'] # begin wxGlade: TerminalSettingsDialog.__init__ kwds["style"] = wx.DEFAULT_DIALOG_STYLE wx.Dialog.__init__(self, *args, **kwds) self.checkbox_echo = wx.CheckBox(self, -1, "Local Echo") self.checkbox_unprintable = wx.CheckBox(self, -1, "Show unprintable characters") self.radio_box_newline = wx.RadioBox(self, -1, "Newline Handling", choices=["CR only", "LF only", "CR+LF"], majorDimension=0, style=wx.RA_SPECIFY_ROWS) self.button_ok = wx.Button(self, -1, "OK") self.button_cancel = wx.Button(self, -1, "Cancel") self.__set_properties() self.__do_layout() # end wxGlade self.__attach_events() self.checkbox_echo.SetValue(self.settings.echo) self.checkbox_unprintable.SetValue(self.settings.unprintable) self.radio_box_newline.SetSelection(self.settings.newline)
def __init__(self, *args, **kwds): # begin wxGlade: ExtractionDialog.__init__ wx.Dialog.__init__(self, *args, **kwds) self.panel_21 = wx.Panel(self, wx.ID_ANY) self.panel_22 = wx.Panel(self, wx.ID_ANY) self.label_2 = wx.StaticText(self, wx.ID_ANY, _("Extraction Location: ")) self.panel_23 = wx.Panel(self, wx.ID_ANY) self.text_ctrl_outpath = wx.TextCtrl(self, wx.ID_ANY, "") self.panel_24 = wx.Panel(self, wx.ID_ANY) self.button_browse_path = wx.Button(self, wx.ID_ANY, _("Browse")) self.panel_25 = wx.Panel(self, wx.ID_ANY) self.panel_10 = wx.Panel(self, wx.ID_ANY) self.panel_13 = wx.Panel(self, wx.ID_ANY) self.radio_box_selection = wx.RadioBox(self, wx.ID_ANY, _("Selection"), choices=[_("Extract All Highlighted")], majorDimension=1, style=wx.RA_SPECIFY_COLS) self.panel_14 = wx.Panel(self, wx.ID_ANY) self.panel_18 = wx.Panel(self, wx.ID_ANY) self.panel_19 = wx.Panel(self, wx.ID_ANY) self.checklistbox_options = wx.CheckListBox(self, wx.ID_ANY) self.panel_20 = wx.Panel(self, wx.ID_ANY) self.panel_12 = wx.Panel(self, wx.ID_ANY) self.panel_15 = wx.Panel(self, wx.ID_ANY) self.button_extract = wx.Button(self, wx.ID_ANY, _("Extract")) self.panel_16 = wx.Panel(self, wx.ID_ANY) self.button_cancel = wx.Button(self, wx.ID_ANY, _("Cancel")) self.panel_17 = wx.Panel(self, wx.ID_ANY) self.panel_11 = wx.Panel(self, wx.ID_ANY) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.button_browse_path_click, self.button_browse_path) self.Bind(wx.EVT_RADIOBOX, self.radio_box_selection_clicked, self.radio_box_selection) self.Bind(wx.EVT_BUTTON, self.button_extract_click, self.button_extract) self.Bind(wx.EVT_BUTTON, self.button_cancel_click, self.button_cancel) # end wxGlade self._InitCheckboxes()
def __init__(self, parent): wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER) vbox = wx.BoxSizer(wx.VERTICAL) title = StaticTextNew(self, label="Fourier Transform Array") title.SetToolTipNew("Fourier Transform Input Array.") vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.input_filename = TextPanelObject(self, "Input File: ", "",150,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") vbox.Add(self.input_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.output_filename = TextPanelObject(self, "Output File: ", "",150,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") vbox.Add(self.output_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) vbox.Add((-1, 5)) self.rbdirection = wx.RadioBox(self, label="To:", choices=['Fourier Space','Real Space',], majorDimension=2, style=wx.RA_SPECIFY_COLS) vbox.Add(self.rbdirection ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.SetAutoLayout(True) self.SetSizer( vbox )
def __init__(self,parent): wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER) vbox = wx.BoxSizer(wx.VERTICAL) title = wx.StaticText(self, label="Numpy array to VTK array") vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.input_filename = TextPanelObject(self, "Input file: ", "input.npy",150,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") vbox.Add(self.input_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) vbox.Add((-1, 5)) self.output_filename = TextPanelObject(self, "Output file: ", "output.vtk",150,"VTK files (*.vtk)|*.vtk|All files (*.*)|*.*") vbox.Add(self.output_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) vbox.Add((-1, 5)) self.rbampphase = wx.RadioBox(self, label="Type", choices=['Amplitude','Phase'], majorDimension=2, style=wx.RA_SPECIFY_COLS) vbox.Add(self.rbampphase,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.SetAutoLayout(True) self.SetSizer( vbox )
def __init__(self, parent, id=wx.ID_ANY, label="", size=(-1,-1), choices=[], majorDimension=0, style=wx.ALIGN_LEFT): wx.RadioBox.__init__(self, parent, id, label=label, size=size, choices=choices, majorDimension=majorDimension, style=style)
def __init__(self,parent,**kwargs): wx.Panel.__init__(self,parent,**kwargs) choices = ['Profile','Contour'] self.fieldradiobox = wx.RadioBox(self,label='Plot Type', style=wx.RA_SPECIFY_COLS, choices=choices) vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(self.fieldradiobox, 0, wx.EXPAND|wx.ALL, 10) self.SetSizer(vbox)
def __init__(self,parent,**kwargs): scrolled.ScrolledPanel.__init__(self, parent,**kwargs) choices = latextounicode(sorted(parent.parent.PP.plotlist.keys())) self.fieldradiobox = wx.RadioBox(self,label='Field', style=wx.RA_SPECIFY_ROWS, choices=choices) vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(self.fieldradiobox, 0, wx.EXPAND|wx.ALL, 10) self.SetSizer(vbox) self.SetAutoLayout(1) self.SetupScrolling(scroll_x=False, scrollToTop=False) #Fix to prevent jump to top when select self.Bind(wx.EVT_CHILD_FOCUS, self.on_focus)
def __init__( self, parent ): wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Teardrops", pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.CAPTION|wx.CLOSE_BOX|wx.DEFAULT_DIALOG_STYLE ) self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize ) bvs_main = wx.BoxSizer( wx.VERTICAL ) rbx_actionChoices = [ u"Set Teardrops", u"Remove All Teardrops" ] self.rbx_action = wx.RadioBox( self, wx.ID_ANY, u"Action", wx.DefaultPosition, wx.DefaultSize, rbx_actionChoices, 1, wx.RA_SPECIFY_ROWS ) self.rbx_action.SetSelection( 0 ) bvs_main.Add( self.rbx_action, 0, wx.ALL, 5 ) gs_params = wx.GridSizer( 0, 2, 0, 0 ) self.st_hpercent = wx.StaticText( self, wx.ID_ANY, u"Horizontal percent", wx.DefaultPosition, wx.DefaultSize, 0 ) self.st_hpercent.Wrap( -1 ) gs_params.Add( self.st_hpercent, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 ) self.sp_hpercent = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 100, 30 ) gs_params.Add( self.sp_hpercent, 0, wx.ALL|wx.SHAPED, 5 ) self.st_vpercent = wx.StaticText( self, wx.ID_ANY, u"Vertical percent", wx.DefaultPosition, wx.DefaultSize, 0 ) self.st_vpercent.Wrap( -1 ) gs_params.Add( self.st_vpercent, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 ) self.sp_vpercent = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 100, 70 ) gs_params.Add( self.sp_vpercent, 0, wx.ALL|wx.SHAPED, 5 ) self.st_nbseg = wx.StaticText( self, wx.ID_ANY, u"Number of segments", wx.DefaultPosition, wx.DefaultSize, 0 ) self.st_nbseg.Wrap( -1 ) gs_params.Add( self.st_nbseg, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 ) self.sp_nbseg = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 2, 100, 10 ) gs_params.Add( self.sp_nbseg, 0, wx.ALL|wx.SHAPED, 5 ) bvs_main.Add( gs_params, 1, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND|wx.SHAPED, 5 ) bhs_modal = wx.BoxSizer( wx.HORIZONTAL ) bhs_modal.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) self.but_cancel = wx.Button( self, wx.ID_ANY, u"Cancel", wx.DefaultPosition, wx.DefaultSize, 0 ) bhs_modal.Add( self.but_cancel, 0, wx.ALIGN_RIGHT|wx.EXPAND, 5 ) self.but_ok = wx.Button( self, wx.ID_ANY, u"Ok", wx.DefaultPosition, wx.DefaultSize, 0 ) bhs_modal.Add( self.but_ok, 0, 0, 5 ) bvs_main.Add( bhs_modal, 0, wx.EXPAND, 5 ) self.SetSizer( bvs_main ) self.Layout() bvs_main.Fit( self ) self.Centre( wx.BOTH )
def __init__(self, parent): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"Selection Frame", pos=wx.DefaultPosition, size=wx.Size(500, 300), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) self.model = WatchableDict() self.model["selection"] = 1 self.model["list"] = [u"One", u"Two", u"Three"] self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) sizer = wx.BoxSizer(wx.VERTICAL) gb_sizer = wx.GridBagSizer(5, 5) gb_sizer.SetFlexibleDirection(wx.BOTH) gb_sizer.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) choices = [] self.combo_box = wx.ComboBox(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, choices, 0) gb_sizer.Add(self.combo_box, wx.GBPosition(0, 0), wx.GBSpan(1, 1), wx.EXPAND, 5) pywatch.wx.ItemContainerItemWatcher(self.combo_box, self.model, "list") pywatch.wx.SelectionChanger(self.combo_box, self.model, "selection") self.choice = wx.Choice(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, choices, 0) self.choice.SetSelection(0) gb_sizer.Add(self.choice, wx.GBPosition(1, 0), wx.GBSpan(1, 1), wx.EXPAND, 5) pywatch.wx.ItemContainerItemWatcher(self.choice, self.model, "list") pywatch.wx.SelectionChanger(self.choice, self.model, "selection") self.list_box = wx.ListBox(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, choices, 0) gb_sizer.Add(self.list_box, wx.GBPosition(2, 0), wx.GBSpan(1, 1), wx.EXPAND, 5) pywatch.wx.ItemContainerItemWatcher(self.list_box, self.model, "list") pywatch.wx.SelectionChanger(self.list_box, self.model, "selection") self.radio_box = wx.RadioBox(self, wx.ID_ANY, u"Radio Box", wx.DefaultPosition, wx.DefaultSize, [u"One", u"Two", u"Three"], 1, wx.RA_SPECIFY_COLS) self.radio_box.SetSelection(0) gb_sizer.Add(self.radio_box, wx.GBPosition(3, 0), wx.GBSpan(1, 1), wx.EXPAND, 5) pywatch.wx.SelectionChanger(self.radio_box, self.model, "selection") gb_sizer.AddGrowableCol(0) gb_sizer.AddGrowableRow(2) sizer.Add(gb_sizer, 1, wx.EXPAND | wx.ALL, 5) self.SetSizer(sizer) self.Layout() self.Centre(wx.BOTH)