Python wx.ALL Examples
The following are 30
code examples of wx.ALL().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
wx
, or try the search function
.
Example #1
Source File: backend_wx.py From Mastering-Elasticsearch-7.0 with MIT License | 7 votes |
def __init__(self, parent, help_entries): wx.Dialog.__init__(self, parent, title="Help", style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) sizer = wx.BoxSizer(wx.VERTICAL) grid_sizer = wx.FlexGridSizer(0, 3, 8, 6) # create and add the entries bold = self.GetFont().MakeBold() for r, row in enumerate(self.headers + help_entries): for (col, width) in zip(row, self.widths): label = wx.StaticText(self, label=col) if r == 0: label.SetFont(bold) label.Wrap(width) grid_sizer.Add(label, 0, 0, 0) # finalize layout, create button sizer.Add(grid_sizer, 0, wx.ALL, 6) OK = wx.Button(self, wx.ID_OK) sizer.Add(OK, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 8) self.SetSizer(sizer) sizer.Fit(self) self.Layout() self.Bind(wx.EVT_CLOSE, self.OnClose) OK.Bind(wx.EVT_BUTTON, self.OnClose)
Example #2
Source File: daily.py From Bruno with MIT License | 6 votes |
def __init__(self): wx.Frame.__init__(self, None, pos=wx.DefaultPosition, size=wx.Size(450, 100), style=wx.MINIMIZE_BOX | wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX | wx.CLIP_CHILDREN, title="BRUNO") panel = wx.Panel(self) ico = wx.Icon('boy.ico', wx.BITMAP_TYPE_ICO) self.SetIcon(ico) my_sizer = wx.BoxSizer(wx.VERTICAL) lbl = wx.StaticText(panel, label="Bienvenido Sir. How can I help you?") my_sizer.Add(lbl, 0, wx.ALL, 5) self.txt = wx.TextCtrl(panel, style=wx.TE_PROCESS_ENTER, size=(400, 30)) self.txt.SetFocus() self.txt.Bind(wx.EVT_TEXT_ENTER, self.OnEnter) my_sizer.Add(self.txt, 0, wx.ALL, 5) panel.SetSizer(my_sizer) self.Show() speak.Speak('''Welcome back Sir, Broono at your service.''')
Example #3
Source File: GUI_wxPython.py From Python-GUI-Programming-Cookbook-Second-Edition with MIT License | 6 votes |
def addStaticBoxWithLabels(self): boxSizerH = wx.BoxSizer(wx.HORIZONTAL) staticBox = wx.StaticBox( self.panel, -1, "Labels within a Frame" ) staticBoxSizerV = wx.StaticBoxSizer( staticBox, wx.VERTICAL ) boxSizerV = wx.BoxSizer( wx.VERTICAL ) staticText1 = wx.StaticText( self.panel, -1, " Choose a number:" ) boxSizerV.Add( staticText1, 0, wx.ALL) staticText2 = wx.StaticText( self.panel, -1, " Label 2") boxSizerV.Add( staticText2, 0, wx.ALL ) #------------------------------------------------------ staticBoxSizerV.Add( boxSizerV, 0, wx.ALL ) boxSizerH.Add(staticBoxSizerV) #------------------------------------------------------ boxSizerH.Add(wx.ComboBox(self.panel, size=(70, -1))) #------------------------------------------------------ boxSizerH.Add(wx.SpinCtrl(self.panel, size=(50, -1), style=wx.BORDER_RAISED)) # Add local boxSizer to main frame self.statBoxSizerV.Add( boxSizerH, 1, wx.ALL ) #----------------------------------------------------------
Example #4
Source File: fourier_demo_wx_sgskip.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 6 votes |
def __init__(self, parent, label, param): self.sliderLabel = wx.StaticText(parent, label=label) self.sliderText = wx.TextCtrl(parent, -1, style=wx.TE_PROCESS_ENTER) self.slider = wx.Slider(parent, -1) # self.slider.SetMax(param.maximum*1000) self.slider.SetRange(0, param.maximum * 1000) self.setKnob(param.value) sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(self.sliderLabel, 0, wx.EXPAND | wx.ALIGN_CENTER | wx.ALL, border=2) sizer.Add(self.sliderText, 0, wx.EXPAND | wx.ALIGN_CENTER | wx.ALL, border=2) sizer.Add(self.slider, 1, wx.EXPAND) self.sizer = sizer self.slider.Bind(wx.EVT_SLIDER, self.sliderHandler) self.sliderText.Bind(wx.EVT_TEXT_ENTER, self.sliderTextHandler) self.param = param self.param.attach(self)
Example #5
Source File: fourier_demo_wx_sgskip.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 6 votes |
def __init__(self, *args, **kwargs): wx.Frame.__init__(self, *args, **kwargs) panel = wx.Panel(self) # create the GUI elements self.createCanvas(panel) self.createSliders(panel) # place them in a sizer for the Layout sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.canvas, 1, wx.EXPAND) sizer.Add(self.frequencySliderGroup.sizer, 0, wx.EXPAND | wx.ALIGN_CENTER | wx.ALL, border=5) sizer.Add(self.amplitudeSliderGroup.sizer, 0, wx.EXPAND | wx.ALIGN_CENTER | wx.ALL, border=5) panel.SetSizer(sizer)
Example #6
Source File: backend_wx.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 6 votes |
def __init__(self, parent, help_entries): wx.Dialog.__init__(self, parent, title="Help", style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) sizer = wx.BoxSizer(wx.VERTICAL) grid_sizer = wx.FlexGridSizer(0, 3, 8, 6) # create and add the entries bold = self.GetFont().MakeBold() for r, row in enumerate(self.headers + help_entries): for (col, width) in zip(row, self.widths): label = wx.StaticText(self, label=col) if r == 0: label.SetFont(bold) label.Wrap(width) grid_sizer.Add(label, 0, 0, 0) # finalize layout, create button sizer.Add(grid_sizer, 0, wx.ALL, 6) OK = wx.Button(self, wx.ID_OK) sizer.Add(OK, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 8) self.SetSizer(sizer) sizer.Fit(self) self.Layout() self.Bind(wx.EVT_CLOSE, self.OnClose) OK.Bind(wx.EVT_BUTTON, self.OnClose)
Example #7
Source File: GUI_wxPython.py From Python-GUI-Programming-Cookbook-Third-Edition with MIT License | 6 votes |
def addStaticBoxWithLabels(self): boxSizerH = wx.BoxSizer(wx.HORIZONTAL) staticBox = wx.StaticBox( self.panel, -1, "Labels within a Frame" ) staticBoxSizerV = wx.StaticBoxSizer( staticBox, wx.VERTICAL ) boxSizerV = wx.BoxSizer( wx.VERTICAL ) staticText1 = wx.StaticText( self.panel, -1, " Choose a number:" ) boxSizerV.Add( staticText1, 0, wx.ALL) staticText2 = wx.StaticText( self.panel, -1, " Label 2") boxSizerV.Add( staticText2, 0, wx.ALL ) #------------------------------------------------------ staticBoxSizerV.Add( boxSizerV, 0, wx.ALL ) boxSizerH.Add(staticBoxSizerV) #------------------------------------------------------ boxSizerH.Add(wx.ComboBox(self.panel, size=(70, -1))) #------------------------------------------------------ boxSizerH.Add(wx.SpinCtrl(self.panel, size=(50, -1), style=wx.BORDER_RAISED)) # Add local boxSizer to main frame self.statBoxSizerV.Add( boxSizerH, 1, wx.ALL ) #----------------------------------------------------------
Example #8
Source File: dfgui.py From PandasDataFrameGUI with MIT License | 6 votes |
def __init__(self, parent, columns, df_list_ctrl): wx.Panel.__init__(self, parent) columns_with_neutral_selection = [''] + list(columns) self.columns = columns self.df_list_ctrl = df_list_ctrl self.figure = Figure(facecolor="white", figsize=(1, 1)) self.axes = self.figure.add_subplot(111) self.canvas = FigureCanvas(self, -1, self.figure) chart_toolbar = NavigationToolbar2Wx(self.canvas) self.combo_box1 = wx.ComboBox(self, choices=columns_with_neutral_selection, style=wx.CB_READONLY) self.Bind(wx.EVT_COMBOBOX, self.on_combo_box_select) row_sizer = wx.BoxSizer(wx.HORIZONTAL) row_sizer.Add(self.combo_box1, 0, wx.ALL | wx.ALIGN_CENTER, 5) row_sizer.Add(chart_toolbar, 0, wx.ALL, 5) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.canvas, 1, flag=wx.EXPAND, border=5) sizer.Add(row_sizer) self.SetSizer(sizer)
Example #9
Source File: guiminer.py From poclbm with GNU General Public License v3.0 | 6 votes |
def __init__(self, parent, title, current_language): style = wx.DEFAULT_DIALOG_STYLE vbox = wx.BoxSizer(wx.VERTICAL) wx.Dialog.__init__(self, parent, -1, title, style=style) self.lbl = wx.StaticText(self, -1, _("Choose language (requires restart to take full effect)")) vbox.Add(self.lbl, 0, wx.ALL, 10) self.language_choices = wx.ComboBox(self, -1, choices=sorted(LANGUAGES.keys()), style=wx.CB_READONLY) self.language_choices.SetStringSelection(LANGUAGES_REVERSE[current_language]) vbox.Add(self.language_choices, 0, wx.ALL, 10) buttons = self.CreateButtonSizer(wx.OK | wx.CANCEL) vbox.Add(buttons, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 10) self.SetSizerAndFit(vbox)
Example #10
Source File: guiminer.py From poclbm with GNU General Public License v3.0 | 6 votes |
def __init__(self, parent, title): style = wx.DEFAULT_DIALOG_STYLE vbox = wx.BoxSizer(wx.VERTICAL) wx.Dialog.__init__(self, parent, -1, title, style=style) self.user_lbl = wx.StaticText(self, -1, STR_USERNAME) self.txt_username = wx.TextCtrl(self, -1, "") self.pass_lbl = wx.StaticText(self, -1, STR_PASSWORD) self.txt_pass = wx.TextCtrl(self, -1, "", style=wx.TE_PASSWORD) grid_sizer_1 = wx.FlexGridSizer(2, 2, 5, 5) grid_sizer_1.Add(self.user_lbl, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_1.Add(self.txt_username, 0, wx.EXPAND, 0) grid_sizer_1.Add(self.pass_lbl, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_1.Add(self.txt_pass, 0, wx.EXPAND, 0) buttons = self.CreateButtonSizer(wx.OK | wx.CANCEL) vbox.Add(grid_sizer_1, wx.EXPAND | wx.ALL, 10) vbox.Add(buttons) self.SetSizerAndFit(vbox)
Example #11
Source File: sct_plugin.py From spinalcordtoolbox with MIT License | 6 votes |
def __init__(self, parent): # TODO: try to use MessageBox instead, as they already include buttons, icons, etc. wx.Dialog.__init__(self, parent, title="SCT Processing") self.SetSize((300, 120)) vbox = wx.BoxSizer(wx.VERTICAL) lbldesc = wx.StaticText(self, id=wx.ID_ANY, label="Processing, please wait...") vbox.Add(lbldesc, 0, wx.ALIGN_LEFT | wx.ALL, 10) btns = self.CreateSeparatedButtonSizer(wx.CANCEL) vbox.Add(btns, 0, wx.ALIGN_LEFT | wx.ALL, 5) hbox = wx.BoxSizer(wx.HORIZONTAL) # TODO: use a nicer image, showing two gears (similar to ID_EXECUTE) save_ico = wx.ArtProvider.GetBitmap(wx.ART_INFORMATION, wx.ART_TOOLBAR, (50, 50)) img_info = wx.StaticBitmap(self, -1, save_ico, wx.DefaultPosition, (save_ico.GetWidth(), save_ico.GetHeight())) hbox.Add(img_info, 0, wx.ALL, 10) hbox.Add(vbox, 0, wx.ALL, 0) self.SetSizer(hbox) self.Centre() self.CenterOnParent() # TODO: retrieve action from the cancel button
Example #12
Source File: guiminer.py From poclbm with GNU General Public License v3.0 | 6 votes |
def __init__(self, parent, url): style = wx.DEFAULT_DIALOG_STYLE vbox = wx.BoxSizer(wx.VERTICAL) wx.Dialog.__init__(self, parent, -1, STR_REFRESH_BALANCE, style=style) self.instructions = wx.StaticText(self, -1, BalanceAuthRequest.instructions) self.website = hyperlink.HyperLinkCtrl(self, -1, url) self.txt_token = wx.TextCtrl(self, -1, _("(Paste token here)")) buttons = self.CreateButtonSizer(wx.OK | wx.CANCEL) vbox.AddMany([ (self.instructions, 0, wx.ALL, 10), (self.website, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 10), (self.txt_token, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 10), (buttons, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 10) ]) self.SetSizerAndFit(vbox)
Example #13
Source File: backend_wx.py From GraphicDesignPatternByPython with MIT License | 6 votes |
def __init__(self, parent, help_entries): wx.Dialog.__init__(self, parent, title="Help", style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) sizer = wx.BoxSizer(wx.VERTICAL) grid_sizer = wx.FlexGridSizer(0, 3, 8, 6) # create and add the entries bold = self.GetFont().MakeBold() for r, row in enumerate(self.headers + help_entries): for (col, width) in zip(row, self.widths): label = wx.StaticText(self, label=col) if r == 0: label.SetFont(bold) label.Wrap(width) grid_sizer.Add(label, 0, 0, 0) # finalize layout, create button sizer.Add(grid_sizer, 0, wx.ALL, 6) OK = wx.Button(self, wx.ID_OK) sizer.Add(OK, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 8) self.SetSizer(sizer) sizer.Fit(self) self.Layout() self.Bind(wx.EVT_CLOSE, self.OnClose) OK.Bind(wx.EVT_BUTTON, self.OnClose)
Example #14
Source File: sct_plugin.py From spinalcordtoolbox with MIT License | 6 votes |
def __init__(self, parent): super(TabPanelGMSeg, self).__init__(parent=parent, id_=wx.ID_ANY) # Fetch input file self.hbox_filein = TextBox(self, label="Input file") # Display all options sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.hbox_filein.hbox, 0, wx.ALL, 5) # Run button button_run = wx.Button(self, id=wx.ID_ANY, label="Run") button_run.Bind(wx.EVT_BUTTON, self.on_button_run) sizer.Add(button_run, 0, wx.ALL, 5) # Add to main sizer self.sizer_h.Add(sizer) self.SetSizerAndFit(self.sizer_h)
Example #15
Source File: charmapdlg.py From trelby with GNU General Public License v2.0 | 6 votes |
def __init__(self, parent, ctrl): wx.Dialog.__init__(self, parent, -1, "Character map") self.ctrl = ctrl hsizer = wx.BoxSizer(wx.HORIZONTAL) self.charMap = MyCharMap(self) hsizer.Add(self.charMap) self.insertButton = wx.Button(self, -1, " Insert character ") hsizer.Add(self.insertButton, 0, wx.ALL, 10) wx.EVT_BUTTON(self, self.insertButton.GetId(), self.OnInsert) gutil.btnDblClick(self.insertButton, self.OnInsert) util.finishWindow(self, hsizer, 0)
Example #16
Source File: radio_group.py From Gooey with MIT License | 6 votes |
def arrange(self, *args, **kwargs): title = getin(self.widgetInfo, ['options', 'title'], _('choose_one')) if getin(self.widgetInfo, ['options', 'show_border'], False): boxDetails = wx.StaticBox(self, -1, title) boxSizer = wx.StaticBoxSizer(boxDetails, wx.VERTICAL) else: title = wx_util.h1(self, title) title.SetForegroundColour(self._options['label_color']) boxSizer = wx.BoxSizer(wx.VERTICAL) boxSizer.AddSpacer(10) boxSizer.Add(title, 0) for btn, widget in zip(self.radioButtons, self.widgets): sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(btn,0, wx.RIGHT, 4) sizer.Add(widget, 1, wx.EXPAND) boxSizer.Add(sizer, 0, wx.ALL | wx.EXPAND, 5) self.SetSizer(boxSizer)
Example #17
Source File: basic_config_panel.py From pyFileFixity with MIT License | 5 votes |
def _do_layout(self): sizer = wx.BoxSizer(wx.VERTICAL) sizer.AddSpacer(50) sizer.Add(self.header_msg, 0, wx.LEFT, 20) sizer.AddSpacer(10) h_sizer = wx.BoxSizer(wx.HORIZONTAL) h_sizer.Add(self.cmd_textbox, 1, wx.ALL | wx.EXPAND) sizer.Add(h_sizer, 0, wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, 20) self.SetSizer(sizer)
Example #18
Source File: elecsus_gui.py From ElecSus with Apache License 2.0 | 5 votes |
def __init__(self, parent, mainwin, ID): """ mainwin is the main panel so we can bind buttons to actions in the main frame """ wx.Panel.__init__(self, parent, id=-1) self.fig = plt.figure(ID,facecolor=(240./255,240./255,240./255),figsize=(12.9,9.75),dpi=80) #self.ax = self.fig.add_subplot(111) # create the wx objects to hold the figure self.canvas = FigureCanvasWxAgg(self, -1, self.fig) self.toolbar = Toolbar(self.canvas) #matplotlib toolbar (pan, zoom, save etc) #self.toolbar.Realize() # Create vertical sizer to hold figure and toolbar - dynamically expand with window size plot_sizer = wx.BoxSizer(wx.VERTICAL) plot_sizer.Add(self.canvas, 1, flag = wx.EXPAND|wx.ALL) #wx.TOP|wx.LEFT|wx.GROW) plot_sizer.Add(self.toolbar, 0, wx.EXPAND) mainwin.figs.append(self.fig) mainwin.fig_IDs.append(ID) # use an ID number to keep track of figures mainwin.canvases.append(self.canvas) # display some text in the middle of the window to begin with self.fig.text(0.5,0.5,'ElecSus GUI\n\nVersion '+__version__+'\n\nTo get started, use the panel on the right\nto either Compute a spectrum or Import some data...', ha='center',va='center') #self.fig.hold(False) self.SetSizer(plot_sizer) #self.Layout() #Fit()
Example #19
Source File: elecsus_gui.py From ElecSus with Apache License 2.0 | 5 votes |
def __init__(self,parent,mainwin,title,plottype,pos): wx.Dialog.__init__(self,parent,wx.ID_ANY,title,size=(400,600),pos=pos) self.mainwin = mainwin self.plottype = plottype win = wx.Panel(self) #,wx.ID_ANY,pos=(0,0),size=(180,200),style=0) self.selection = wx.CheckListBox(win, wx.ID_ANY, choices = OutputPlotTypes, size=(120,-1))#,pos=(0,0)) #self.win.Bind(wx.EVT_CHECKLISTBOX, self.OnTicked, self.selection) self.selection.Bind(wx.EVT_CHECKLISTBOX, self.OnTicked) if plottype == 'Theory': display_curves = self.mainwin.display_theory_curves else: display_curves = self.mainwin.display_expt_curves checked_items = [] for i in range(len(display_curves)): if display_curves[i]: checked_items.append(i) self.selection.SetChecked(checked_items) #self.okbtn = wx.Button(self.win,wx.ID_OK,size=(120,BtnSize)) #self.Bind(wx.EVT_BUTTON, self.OnOK, self.okbtn) self.SetSize(self.selection.GetSize()+(50,50)) self.SetMinSize(self.selection.GetSize()+(50,50)) popup_sizer = wx.BoxSizer(wx.VERTICAL) popup_sizer.Add(self.selection,0,wx.EXPAND|wx.ALL, 7) #popup_sizer.Add((-1,5),1,wx.EXPAND) #popup_sizer.Add(self.okbtn,0,wx.EXPAND) #sz = popup_sizer.GetBestSize() #self.win.SetSize((sz.width+20, sz.height+20)) self.SetSizer(popup_sizer) wx.CallAfter(self.Refresh)
Example #20
Source File: sct_plugin.py From spinalcordtoolbox with MIT License | 5 votes |
def __init__(self, parent): wx.Dialog.__init__(self, parent, title="SCT Error") self.SetSize((510, 170)) vbox = wx.BoxSizer(wx.VERTICAL) lbldesc = wx.StaticText(self, id=-1, label="An error has occurred while running SCT. Please go to the Terminal, copy all " "the content and paste it as a new issue in SCT's forum: \n" "http://forum.spinalcordmri.org/", size=wx.Size(470, 60), style=wx.ALIGN_LEFT) vbox.Add(lbldesc, 0, wx.ALIGN_LEFT | wx.ALL, 10) btns = self.CreateSeparatedButtonSizer(wx.OK) vbox.Add(btns, 0, wx.ALIGN_LEFT | wx.ALL, 5) hbox = wx.BoxSizer(wx.HORIZONTAL) save_ico = wx.ArtProvider.GetBitmap(wx.ART_ERROR, wx.ART_TOOLBAR, (50, 50)) img_info = wx.StaticBitmap(self, -1, save_ico, wx.DefaultPosition, (save_ico.GetWidth(), save_ico.GetHeight())) hbox.Add(img_info, 0, wx.ALL, 10) hbox.Add(vbox, 0, wx.ALL, 0) self.SetSizer(hbox) self.Centre() self.CenterOnParent()
Example #21
Source File: sct_plugin.py From spinalcordtoolbox with MIT License | 5 votes |
def __init__(self, parent, id_): super(SCTPanel, self).__init__(parent=parent, id=id_) # Logo self.img_logo = self.get_logo() self.sizer_logo_sct = wx.BoxSizer(wx.VERTICAL) self.sizer_logo_sct.Add(self.img_logo, 0, wx.ALL, 5) # Citation txt_sct_citation = wx.VSCROLL | \ wx.HSCROLL | wx.TE_READONLY | \ wx.BORDER_SIMPLE html_sct_citation = html.HtmlWindow(self, wx.ID_ANY, size=(280, 115), style=txt_sct_citation) html_sct_citation.SetPage(self.DESCRIPTION_SCT) self.sizer_logo_sct.Add(html_sct_citation, 0, wx.ALL, 5) # Help button button_help = wx.Button(self, id=id_, label="Help") button_help.Bind(wx.EVT_BUTTON, self.tutorial) self.sizer_logo_sct.Add(button_help, 0, wx.ALL, 5) # Get function-specific description self.html_desc = self.get_description() # Organize boxes self.sizer_logo_text = wx.BoxSizer(wx.HORIZONTAL) # create main box self.sizer_logo_text.Add(self.sizer_logo_sct, 0, wx.ALL, 5) # TODO: increase the width of the description box self.sizer_logo_text.Add(self.html_desc, 0, wx.ALL, 5) self.sizer_h = wx.BoxSizer(wx.HORIZONTAL) self.sizer_h.Add(self.sizer_logo_text)
Example #22
Source File: sct_plugin.py From spinalcordtoolbox with MIT License | 5 votes |
def __init__(self, sctpanel, label=""): """ :param sctpanel: SCTPanel Class :param label: Label to display on the button """ # TODO: instead of this hard-coded 1000 value, extended the text box towards the most right part of the panel # (include a margin) self.textctrl = wx.TextCtrl(sctpanel, -1, "", wx.DefaultPosition, wx.Size(1000, 10)) hbox = wx.BoxSizer(wx.HORIZONTAL) button_fetch_file = wx.Button(sctpanel, -1, label=label) button_fetch_file.Bind(wx.EVT_BUTTON, self.get_highlighted_file_name) hbox.Add(button_fetch_file, proportion=0, flag=wx.ALIGN_LEFT | wx.ALL, border=5) hbox.Add(self.textctrl, 1, wx.EXPAND | wx.ALIGN_LEFT | wx.ALL, 5) self.hbox = hbox
Example #23
Source File: elecsus_gui.py From ElecSus with Apache License 2.0 | 5 votes |
def __init__(self,parent,style,mainwin,plottype): wx.PopupTransientWindow.__init__(self,parent,style) self.mainwin = mainwin self.plottype = plottype win = wx.Panel(self) #,wx.ID_ANY,pos=(0,0),size=(180,200),style=0) self.selection = wx.CheckListBox(win, wx.ID_ANY, choices = OutputPlotTypes, size=(150,-1))#,pos=(0,0)) #self.win.Bind(wx.EVT_CHECKLISTBOX, self.OnTicked, self.selection) self.selection.Bind(wx.EVT_CHECKLISTBOX, self.OnTicked) if plottype == 'Theory': display_curves = self.mainwin.display_theory_curves else: display_curves = self.mainwin.display_expt_curves checked_items = [] for i in range(len(display_curves)): if display_curves[i]: checked_items.append(i) self.selection.SetChecked(checked_items) self.SetSize(self.selection.GetSize()+(10,10)) self.SetMinSize(self.selection.GetSize()+(10,10)) popup_sizer = wx.BoxSizer(wx.VERTICAL) popup_sizer.Add(self.selection,0,wx.ALL, 7) win.SetSizer(popup_sizer) popup_sizer.Fit(win) self.Layout()
Example #24
Source File: PyDraw.py From advancedpython3 with GNU General Public License v3.0 | 5 votes |
def __init__(self, title): super().__init__(None, title=title, size=(300, 200)) # Set up the controller self.controller = PyDrawController(self) # Set up the layout fo the UI self.vertical_box_sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(self.vertical_box_sizer) # Set up the menu bar self.SetMenuBar(PyDrawMenuBar()) # Set up the toolbar self.vertical_box_sizer.Add(PyDrawToolBar(self), wx.ID_ANY, wx.EXPAND | wx.ALL, ) # Setup drawing panel self.drawing_panel = DrawingPanel(self, self.controller.get_mode) self.drawing_controller = self.drawing_panel.controller # Add the Panel to the Frames Sizer self.vertical_box_sizer.Add(self.drawing_panel, wx.ID_ANY, wx.EXPAND | wx.ALL) # Set up the command event handling for the menu bar and tool bar self.Bind(wx.EVT_MENU, self.controller.command_menu_handler) self.Centre()
Example #25
Source File: gui.py From superpaper with MIT License | 5 votes |
def create_sizer_profiles(self): # choice menu self.list_of_profiles = list_profiles() self.profnames = [] for prof in self.list_of_profiles: self.profnames.append(prof.name) self.profnames.append("Create a new profile") self.choice_profiles = wx.Choice(self, -1, name="ProfileChoice", choices=self.profnames) self.choice_profiles.Bind(wx.EVT_CHOICE, self.onSelect) st_choice_profiles = wx.StaticText(self, -1, "Setting profiles:") # name txt ctrl st_name = wx.StaticText(self, -1, "Profile name:") self.tc_name = wx.TextCtrl(self, -1, size=(self.tc_width, -1)) self.tc_name.SetMaxLength(14) # buttons self.button_new = wx.Button(self, label="New") self.button_save = wx.Button(self, label="Save") self.button_delete = wx.Button(self, label="Delete") self.button_new.Bind(wx.EVT_BUTTON, self.onCreateNewProfile) self.button_save.Bind(wx.EVT_BUTTON, self.onSave) self.button_delete.Bind(wx.EVT_BUTTON, self.onDeleteProfile) # Add elements to the sizer self.sizer_profiles.Add(st_choice_profiles, 0, wx.CENTER|wx.ALL, 5) self.sizer_profiles.Add(self.choice_profiles, 0, wx.CENTER|wx.ALL, 5) self.sizer_profiles.Add(st_name, 0, wx.CENTER|wx.ALL, 5) self.sizer_profiles.Add(self.tc_name, 0, wx.CENTER|wx.ALL, 5) self.sizer_profiles.Add(self.button_new, 0, wx.CENTER|wx.ALL, 5) self.sizer_profiles.Add(self.button_save, 0, wx.CENTER|wx.ALL, 5) self.sizer_profiles.Add(self.button_delete, 0, wx.CENTER|wx.ALL, 5)
Example #26
Source File: gui.py From superpaper with MIT License | 5 votes |
def refresh_path_listctrl(self, use_multi_image, migrate_paths=False): if use_multi_image == self.multi_column_listc and migrate_paths: self.sizer_main.Layout() else: if migrate_paths and self.path_listctrl.GetItemCount(): # warn that paths can't be migrated msg = ("Wallpaper sources cannot be migrated between span" " and multi image, continue?" "\n" "Saved sources are not affected until you overwrite.") res = show_message_dialog(msg, style="YES_NO") if not res: # user canceled return False self.path_listctrl.Destroy() self.image_list.RemoveAll() if use_multi_image: self.multi_column_listc = True self.path_listctrl = wx.ListCtrl(self.statbox_parent_paths, -1, style=wx.LC_REPORT | wx.BORDER_SIMPLE | wx.LC_SORT_ASCENDING ) self.path_listctrl.InsertColumn(0, 'Display', wx.LIST_FORMAT_RIGHT, width=100) self.path_listctrl.InsertColumn(1, 'Source', width=400) else: self.multi_column_listc = False # show simpler listing without header if only one wallpaper target self.path_listctrl = wx.ListCtrl(self.statbox_parent_paths, -1, style=wx.LC_REPORT | wx.BORDER_SIMPLE | wx.LC_NO_HEADER ) self.path_listctrl.InsertColumn(0, 'Source', width=500) self.path_listctrl.SetImageList(self.image_list, wx.IMAGE_LIST_SMALL) self.sizer_setting_paths.Insert(1, self.path_listctrl, 1, wx.CENTER | wx.EXPAND | wx.ALL, 5) self.path_listctrl.InvalidateBestSize() self.sizer_main.Layout() return True
Example #27
Source File: gui.py From superpaper with MIT License | 5 votes |
def create_sizer_bottom_buttonrow(self): self.button_help = wx.Button(self, label="Help") self.button_align_test = wx.Button(self, label="Align Test") self.button_perspectives = wx.Button(self, label="Perspectives") self.button_apply = wx.Button(self, label="Apply") self.button_close = wx.Button(self, label="Close") self.button_apply.Bind(wx.EVT_BUTTON, self.onApply) self.button_align_test.Bind(wx.EVT_BUTTON, self.onAlignTest) self.button_perspectives.Bind(wx.EVT_BUTTON, self.onPerspectives) self.button_help.Bind(wx.EVT_BUTTON, self.onHelp) self.button_close.Bind(wx.EVT_BUTTON, self.onClose) self.sizer_bottom_buttonrow.Add(self.button_help, 0, wx.ALIGN_LEFT|wx.ALL, 5) self.sizer_bottom_buttonrow.Add(self.button_align_test, 0, wx.ALIGN_LEFT|wx.ALL, 5) self.sizer_bottom_buttonrow.Hide(self.button_align_test) self.sizer_bottom_buttonrow.Add(self.button_perspectives, 0, wx.ALIGN_LEFT|wx.ALL, 5) self.sizer_bottom_buttonrow.Hide(self.button_perspectives) self.sizer_bottom_buttonrow.Layout() self.sizer_bottom_buttonrow.AddStretchSpacer() self.sizer_bottom_buttonrow.Add(self.button_apply, 0, wx.ALL, 5) self.sizer_bottom_buttonrow.Add(self.button_close, 0, wx.ALL, 5) # # Profile loading and display methods #
Example #28
Source File: gui.py From superpaper with MIT License | 5 votes |
def create_sizer_diaginch_override(self): self.sizer_setting_diaginch.Clear(True) # statbox_parent_diaginch = self.sizer_setting_diaginch.GetStaticBox() statbox_parent_diaginch = self self.cb_diaginch = wx.CheckBox(statbox_parent_diaginch, -1, "Input display sizes manually") self.cb_diaginch.Bind(wx.EVT_CHECKBOX, self.onCheckboxDiaginch) st_diaginch = wx.StaticText( statbox_parent_diaginch, -1, "Display diagonal sizes (inches):" ) st_diaginch.Disable() self.sizer_setting_diaginch.Add(self.cb_diaginch, 0, wx.ALIGN_LEFT|wx.LEFT, 0) self.sizer_setting_diaginch.Add(st_diaginch, 0, wx.ALIGN_LEFT|wx.LEFT, 10) # diag size data for fields diags = [str(dsp.diagonal_size()[1]) for dsp in self.display_sys.disp_list] # sizer for textctrls tc_list_sizer_diag = wx.WrapSizer(wx.HORIZONTAL) self.tc_list_diaginch = self.list_of_textctrl(statbox_parent_diaginch, wpproc.NUM_DISPLAYS, fraction=2/5) for tc, diag in zip(self.tc_list_diaginch, diags): tc_list_sizer_diag.Add(tc, 0, wx.ALIGN_LEFT|wx.ALL, 5) tc.ChangeValue(diag) tc.Disable() self.button_diaginch_save = wx.Button(statbox_parent_diaginch, label="Save") self.button_diaginch_save.Bind(wx.EVT_BUTTON, self.onSaveDiagInch) tc_list_sizer_diag.Add(self.button_diaginch_save, 0, wx.ALL, 5) self.button_diaginch_save.Disable() self.sizer_setting_diaginch.Add(tc_list_sizer_diag, 0, wx.ALIGN_LEFT|wx.LEFT, 5) self.sizer_setting_adv.Layout() self.sizer_main.Layout() self.sizer_main.Fit(self.frame) # Check cb according to DisplaySystem 'use_user_diags' self.cb_diaginch.SetValue(self.display_sys.use_user_diags) # Update sizer content based on new cb state self.onCheckboxDiaginch(None)
Example #29
Source File: gui.py From superpaper with MIT License | 5 votes |
def create_sizer_paths(self): self.sizer_setting_paths = wx.StaticBoxSizer(wx.VERTICAL, self, "Wallpaper paths") self.statbox_parent_paths = self.sizer_setting_paths.GetStaticBox() st_paths_info = wx.StaticText(self.statbox_parent_paths, -1, "Browse to add your wallpaper files or source folders here:") if self.use_multi_image: self.path_listctrl = wx.ListCtrl(self.statbox_parent_paths, -1, style=wx.LC_REPORT | wx.BORDER_SIMPLE | wx.LC_SORT_ASCENDING ) self.path_listctrl.InsertColumn(0, 'Display', wx.LIST_FORMAT_RIGHT, width = 100) self.path_listctrl.InsertColumn(1, 'Source', width = 400) else: # show simpler listing without header if only one wallpaper target self.path_listctrl = wx.ListCtrl(self.statbox_parent_paths, -1, style=wx.LC_REPORT | wx.BORDER_SIMPLE | wx.LC_NO_HEADER ) self.path_listctrl.InsertColumn(0, 'Source', width = 500) self.path_listctrl.SetImageList(self.image_list, wx.IMAGE_LIST_SMALL) self.sizer_setting_paths.Add(st_paths_info, 0, wx.ALIGN_LEFT|wx.ALL, 5) self.sizer_setting_paths.Add( self.path_listctrl, 1, wx.CENTER|wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT, 5 ) # Buttons self.sizer_setting_paths_buttons = wx.BoxSizer(wx.HORIZONTAL) self.button_browse = wx.Button(self.statbox_parent_paths, label="Browse") self.button_remove_source = wx.Button(self.statbox_parent_paths, label="Remove selected source") self.button_browse.Bind(wx.EVT_BUTTON, self.onBrowsePaths) self.button_remove_source.Bind(wx.EVT_BUTTON, self.onRemoveSource) self.sizer_setting_paths_buttons.Add(self.button_browse, 0, wx.CENTER|wx.ALL, 5) self.sizer_setting_paths_buttons.Add(self.button_remove_source, 0, wx.CENTER|wx.ALL, 5) # add button sizer to parent paths sizer self.sizer_setting_paths.Add(self.sizer_setting_paths_buttons, 0, wx.CENTER|wx.EXPAND|wx.ALL, 0) self.sizer_settings_right.Add( self.sizer_setting_paths, 1, wx.CENTER|wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT, 5 )
Example #30
Source File: gui.py From RF-Monitor with GNU General Public License v2.0 | 5 votes |
def __add_monitor(self, monitor): if monitor.get_colour() is None: colours = self.__get_used_colours() if len(colours): colour = colours[0] else: index = len(self._monitors) % COLOURS colour = self._colours[index] monitor.set_colour(colour) self._toolbar.enable_freq(False) self._monitors.append(monitor) self._sizerMonitors.Add(monitor, 0, wx.ALL | wx.EXPAND, 5) self.Layout()