我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用wx.StaticText()。
def InitUI(self): #draw the pannel wx.StaticText(self, label='Select elements to download to local storage', pos=(30, 5)) self.cb_conf = wx.CheckBox(self, label='Config',pos = (80,30)) self.cb_logs = wx.CheckBox(self, label='Logs',pos = (80,55)) self.cb_cron = wx.CheckBox(self, label='Crontab',pos = (80,80)) self.cb_pics = wx.CheckBox(self, label='Photos',pos = (80,105)) self.cb_graph = wx.CheckBox(self, label='Graphs',pos = (80,130)) #right side self.cb_all = wx.CheckBox(self, label='Back up\nWhole Pigrow Folder',pos = (270,75)) #progress bar wx.StaticText(self, label='saving to; '+ localfiles_info_pnl.local_path, pos=(15, 155)) self.current_file_txt = wx.StaticText(self, label='--', pos=(30, 190)) self.current_dest_txt = wx.StaticText(self, label='--', pos=(30, 215)) #buttons self.start_download_btn = wx.Button(self, label='Download files', pos=(40, 240), size=(175, 50)) self.start_download_btn.Bind(wx.EVT_BUTTON, self.start_download_click) self.close_btn = wx.Button(self, label='Close', pos=(415, 240), size=(175, 50)) self.close_btn.Bind(wx.EVT_BUTTON, self.OnClose) ## universal controls pnl = wx.Panel(self)
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.''')
def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title, size=(400, 250)) panel = wx.Panel(self, wx.ID_ANY) panel.SetBackgroundColour('#000000') text = """\n \t \t \t E-Z Music Downloader v1.0 \n \n Type in the song you want to downloading the the first box like so: "Song name by Artist" make sure you have both the artist and the song name in the query, in the second box type in what you want to name the Mp3. Next select High quality or Medium quality. High quality creates a larger file, therefore takes longer to convert. The status bar will show the actions the program is doing, once the status bar says done you can download another. To change the directory in which the song downloads, go to options in the menu bar and select "ChangeDownloadDirectory". \n \n \t \t Thanks for chosing E-Z Musick Downloader! \n \n \t (Songs converted using http://www.convertmemp3.com )""" txt = wx.StaticText(panel, label=text) txt.SetForegroundColour('#FFFFFF') sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(txt, 1, wx.EXPAND|wx.ALIGN_CENTER, 5) panel.SetSizer(sizer) self.Show() self.Centre()
def __init__(self, parent, id, title, message, download_url, size=wx.DefaultSize, pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE, name='dialog'): wx.Dialog.__init__(self, parent, id, title, pos, size, style, name) label = wx.StaticText(self, label=message) button = wx.Button(self, id=wx.ID_OK, label="Close") button.SetDefault() line = wx.StaticLine(self, wx.ID_ANY, size=(20, -1), style=wx.LI_HORIZONTAL) download_ctrl = hl.HyperLinkCtrl(self, wx.ID_ANY, download_url, URL=download_url) sizer = wx.BoxSizer(wx.VERTICAL) button_sizer = wx.StdDialogButtonSizer() button_sizer.AddButton(button) button_sizer.Realize() sizer.Add(label, 0, wx.ALIGN_CENTER|wx.ALL, 5) sizer.Add(download_ctrl, 0, wx.ALL, 10) sizer.Add(line, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.RIGHT|wx.TOP, 5) sizer.Add(button_sizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) self.SetSizer(sizer) sizer.Fit(self)
def __init__(self, parent=None, default_url=""): wx.Panel.__init__(self, parent) self._sizer = wx.BoxSizer(wx.HORIZONTAL) self._url = wx.TextCtrl(self) self._url.Bind(wx.EVT_KILL_FOCUS, self._field_changed) self._url.SetValue(default_url) self._status_label = ProcessingPlaceholderText(self) label = wx.StaticText(self, label="Server URL") label.SetToolTipString("URL for the IRIDA server API.") self._sizer.Add(label, flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, border=5, proportion=0) self._sizer.Add(self._url, flag=wx.EXPAND, proportion=1) self._sizer.Add(self._status_label, flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, border=5, proportion=0) self.SetSizerAndFit(self._sizer) self.Layout() self.Bind(wx.EVT_CLOSE, self._on_close) pub.subscribe(self._status_label.SetError, APIConnectorTopics.connection_error_url_topic) pub.subscribe(self._status_label.SetSuccess, APIConnectorTopics.connection_success_topic) pub.subscribe(self._status_label.SetSuccess, APIConnectorTopics.connection_success_valid_url)
def _post_processing_task_started(self): """Show a 'processing' message on the UI while the post processing task is executing.""" pub.unsubscribe(self._post_processing_task_started, RunUploaderTopics.started_post_processing) pub.subscribe(self._post_processing_task_completed, RunUploaderTopics.finished_post_processing) pub.subscribe(self._post_processing_task_failed, RunUploaderTopics.failed_post_processing) logging.info("Post-processing started, updating UI.") self.Freeze() self._post_processing_sizer = wx.BoxSizer(wx.HORIZONTAL) self._post_processing_placeholder = ProcessingPlaceholderText(self) self._post_processing_placeholder.SetFont(wx.Font(pointSize=18, family=wx.FONTFAMILY_DEFAULT, style=wx.NORMAL, weight=wx.FONTWEIGHT_BOLD, face="Segoe UI Symbol")) self._post_processing_text = wx.StaticText(self, label="Executing post-processing task.") self._post_processing_text.SetFont(wx.Font(18, wx.DEFAULT, wx.NORMAL, wx.BOLD)) self._post_processing_text.Wrap(350) self._post_processing_text.SetToolTipString("Executing command `{}`.".format(read_config_option("completion_cmd"))) self._post_processing_sizer.Add(self._post_processing_text, flag=wx.RIGHT, border=5, proportion=1) self._post_processing_sizer.Add(self._post_processing_placeholder, flag=wx.LEFT, border=5, proportion=0) self._sizer.Insert(0, self._post_processing_sizer, flag=wx.EXPAND | wx.ALL, border=5) self.Layout() self.Thaw()
def __init__(self, parent, message, caption, choices=[]): wx.Dialog.__init__(self, parent, -1) self.SetTitle(caption) sizer = wx.BoxSizer(wx.VERTICAL) self.message = wx.StaticText(self, -1, message) self.clb = wx.CheckListBox(self, -1, choices=choices) self.chbox = wx.CheckBox(self, -1, 'Select all') self.btns = self.CreateSeparatedButtonSizer(wx.OK | wx.CANCEL) self.Bind(wx.EVT_CHECKBOX, self.EvtChBox, self.chbox) sizer.Add(self.message, 0, wx.ALL | wx.EXPAND, 5) sizer.Add(self.clb, 1, wx.ALL | wx.EXPAND, 5) sizer.Add(self.chbox, 0, wx.ALL | wx.EXPAND, 5) sizer.Add(self.btns, 0, wx.ALL | wx.EXPAND, 5) self.SetSizer(sizer) # self.Fit()
def initGain(self): gainSizer = wx.BoxSizer(orient=wx.VERTICAL) gainControlBox = widgets.ControlBox(self, label='Gain', orient=wx.HORIZONTAL) self.gainText = wx.StaticText(self, label='%0.2f' % self.pg.gain) gainTextSizer = wx.BoxSizer(orient=wx.VERTICAL) gainTextSizer.Add(self.gainText, proportion=1, flag=wx.EXPAND) self.gainSlider = wx.Slider(self, style=wx.SL_HORIZONTAL, value=int(self.pg.gain*100.0), minValue=1, maxValue=100) self.Bind(wx.EVT_SLIDER, self.setGain, self.gainSlider) gainControlBox.Add(gainTextSizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=10) gainControlBox.Add(self.gainSlider, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) gainSizer.Add(gainControlBox, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) self.sizer.Add(gainSizer, proportion=0, flag=wx.EXPAND)
def initControls(self): # slider for controlling the length of the spans in Welch's method # since sliders are int, we use divide by 4 to get float value spanControlBox = widgets.ControlBox(self, label='Span', orient=wx.HORIZONTAL) self.spanText = wx.StaticText(self, label='%4.2f(s)' % self.pg.welchConfig.span) spanTextSizer = wx.BoxSizer(orient=wx.VERTICAL) spanTextSizer.Add(self.spanText, proportion=1, flag=wx.LEFT | wx.RIGHT | wx.EXPAND, border=8) self.spanSlider = wx.Slider(self, style=wx.SL_HORIZONTAL, value=int(self.pg.welchConfig.span*4), minValue=1, maxValue=12) spanControlBox.Add(spanTextSizer, proportion=0, flag=wx.TOP, border=10) spanControlBox.Add(self.spanSlider, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) self.Bind(wx.EVT_SLIDER, self.setSpan, self.spanSlider) self.sizer.Add(spanControlBox, proportion=0, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10)
def initSigControls(self): """Initialize signal controls. """ sigSizer = wx.BoxSizer(orient=wx.VERTICAL) scaleControlBox = widgets.ControlBox(self, label='Noise', orient=wx.VERTICAL) self.scaleText = wx.StaticText(self, label='%4.1f' % self.src.scale.value) scaleTextSizer = wx.BoxSizer(orient=wx.VERTICAL) scaleTextSizer.Add(self.scaleText, proportion=1, flag=wx.EXPAND) self.scaleSlider = wx.Slider(self, style=wx.SL_VERTICAL, value=self.src.scale.value*10.0, minValue=1, maxValue=100) self.Bind(wx.EVT_SLIDER, self.setScale, self.scaleSlider) scaleControlBox.Add(scaleTextSizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=10) scaleControlBox.Add(self.scaleSlider, proportion=1, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) sigSizer.Add(scaleControlBox, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) self.sizer.Add(sigSizer, proportion=1, flag=wx.EXPAND)
def OnCloseFloatingPage(self, event): event.Skip() frame = event.GetEventObject() page_title = frame.GetTitle() page_contents = list(frame.GetChildren())[-1] #self.InsertPage(frame.page_index, page_contents, page_title, select=True, bitmap=frame.bitmap, control=frame.control) #self.InsertPage(frame.page_index, wx.StaticText(self, label='hello world'), page_title, select=True)#, bitmap=frame.bitmap, control=frame.control) page_contents.Reparent(self) wx.Yield() # report this bug XXX - idfah self.InsertPage(frame.page_index, page_contents, page_title, select=True, bitmap=frame.bitmap, control=frame.control) if frame.control: src_tabs, idx = self.FindTab(page_contents) frame.control.Reparent(src_tabs) frame.control.Hide() frame.control = None self.SetPageTextColour(frame.page_index, frame.text_colour)
def __init__(self, *args, **kwds): # begin wxGlade: Dialog_snapshot.__init__ kwds["style"] = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER wx.Dialog.__init__(self, *args, **kwds) self.label_1 = wx.StaticText(self, wx.ID_ANY, "Nombre:") self.nombre_snap = wx.TextCtrl(self, wx.ID_ANY, "") self.label_2 = wx.StaticText(self, wx.ID_ANY, u"Descripci\u00f3n:") self.descripcion_snap = wx.TextCtrl(self, wx.ID_ANY, "") self.checkbox_memory = wx.CheckBox(self, wx.ID_ANY, "memory") self.checkbox_quiesce = wx.CheckBox(self, wx.ID_ANY, "quiesce") self.snap_ok = wx.Button(self, wx.ID_OK, "OK") self.snap_cancel = wx.Button(self, wx.ID_CANCEL, "Cancel") self.__set_properties() self.__do_layout() # end wxGlade
def __init__(self, parent, log): self.log = log wx.Panel.__init__(self, parent, -1) from wx.lib.floatcanvas.ScreenShot import getScreenShotBitmap note1 = wx.StaticText(self, -1, errorText) note2 = wx.StaticText(self, -1, "This is what the FloatCanvas can look like:") S = wx.BoxSizer(wx.VERTICAL) S.Add((10, 10), 1) S.Add(note1, 0, wx.ALIGN_CENTER) S.Add(note2, 0, wx.ALIGN_CENTER | wx.BOTTOM, 4) S.Add(wx.StaticBitmap(self,-1,getScreenShotBitmap()),0,wx.ALIGN_CENTER) S.Add((10, 10), 1) self.SetSizer(S) self.Layout()
def __init__(self, parent, log): self.log = log wx.Panel.__init__(self, parent, -1) note1 = wx.StaticText(self, -1, "The FloatCanvas Demo needs") note2 = wx.StaticText(self, -1, "a separate frame") b = wx.Button(self, -1, "Open Demo Frame Now") b.Bind(wx.EVT_BUTTON, self.OnButton) S = wx.BoxSizer(wx.VERTICAL) S.Add((10, 10), 1) S.Add(note1, 0, wx.ALIGN_CENTER) S.Add(note2, 0, wx.ALIGN_CENTER | wx.BOTTOM, 5) S.Add(b, 0, wx.ALIGN_CENTER | wx.ALL, 5) S.Add((10, 10), 1) self.SetSizer(S) self.Layout()
def makeSettings(self, settingsSizer): # Translators: This is the static text of the Quick Profile Wizard dialog. msgIntro=_("Choose which options you want to reset to the default value for the Lambdas profile") self.introStxt=wx.StaticText(self,-1,label=msgIntro) settingsSizer.Add(self.introStxt,flag=wx.BOTTOM) # Translators: This is the label for a checkbox in the # Quick Profile Wizard dialog. self.defaultTranslationTableCheckBox=wx.CheckBox(self,wx.NewId(),label=_("Keep the LAMBDA braille table for the current language (%s)") % TABLE_NAME) self.defaultTranslationTableCheckBox.SetValue(True) settingsSizer.Add(self.defaultTranslationTableCheckBox,border=10,flag=wx.BOTTOM) # Translators: This is the label for a checkbox in the # Quick Profile Wizard dialog. self.brailleTetherToFocusCheckBox=wx.CheckBox(self,wx.NewId(),label=_("Set the braille cursor to tether the focus")) self.brailleTetherToFocusCheckBox.SetValue(True) settingsSizer.Add(self.brailleTetherToFocusCheckBox,border=10,flag=wx.BOTTOM) # Translators: This is the label for a checkbox in the # Quick Profile Wizard dialog. self.disableReadByParagraphCheckBox=wx.CheckBox(self,wx.NewId(),label=_("Disable the Braille reading by paragraph")) self.disableReadByParagraphCheckBox.SetValue(True) settingsSizer.Add(self.disableReadByParagraphCheckBox,border=10,flag=wx.BOTTOM) # Translators: This is the label for a checkbox in the # Quick Profile Wizard dialog. self.disableBrailleWordWrapCheckBox=wx.CheckBox(self,wx.NewId(),label=_("Disable word wrappping of the braille line")) self.disableBrailleWordWrapCheckBox.SetValue(True) settingsSizer.Add(self.disableBrailleWordWrapCheckBox,border=10,flag=wx.BOTTOM)
def __init__(self, *args, **kwds): # begin wxGlade: LogicalVolumeDialog.__init__ wx.Dialog.__init__(self, *args, **kwds) self.panel_1 = wx.Panel(self, wx.ID_ANY) self.panel_4 = wx.Panel(self, wx.ID_ANY) self.label_1 = wx.StaticText(self, wx.ID_ANY, _("Select Logical Volume: "), style=wx.ALIGN_CENTER_HORIZONTAL) self.panel_7 = wx.Panel(self, wx.ID_ANY) self.combo_logical_volumes = wx.ComboBox(self, wx.ID_ANY, choices=[], style=wx.CB_DROPDOWN) self.panel_8 = wx.Panel(self, wx.ID_ANY) self.panel_3 = wx.Panel(self, wx.ID_ANY) self.panel_5 = wx.Panel(self, wx.ID_ANY) self.button_select = wx.Button(self, wx.ID_OK, _("Select")) self.panel_9 = wx.Panel(self, wx.ID_ANY) self.button_cancel = wx.Button(self, wx.ID_CANCEL, _("Cancel")) self.panel_6 = wx.Panel(self, wx.ID_ANY) self.panel_2 = wx.Panel(self, wx.ID_ANY) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.button_select_click, id=wx.ID_OK) self.Bind(wx.EVT_BUTTON, self.button_cancel_click, id=wx.ID_CANCEL) # end wxGlade self.PopulateVolumes()
def __init__( self, parent ): win_height = parent.GetSize()[1] height_of_pannels_above = 230 space_left = win_height - height_of_pannels_above wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = (0, height_of_pannels_above), size = wx.Size(285, space_left), style = wx.TAB_TRAVERSAL ) # Start drawing the UI elements wx.StaticText(self, label='Pigrow Config', pos=(25, 10)) self.update_config_btn = wx.Button(self, label='read config from pigrow', pos=(15, 60), size=(175, 30)) self.update_config_btn.Bind(wx.EVT_BUTTON, self.update_config_click) self.name_box_btn = wx.Button(self, label='change box name', pos=(15, 95), size=(175, 30)) self.name_box_btn.Bind(wx.EVT_BUTTON, self.name_box_click) self.config_lamp_btn = wx.Button(self, label='config lamp', pos=(15, 130), size=(175, 30)) self.config_lamp_btn.Bind(wx.EVT_BUTTON, self.config_lamp_click) self.config_dht_btn = wx.Button(self, label='config dht', pos=(15, 165), size=(175, 30)) self.config_dht_btn.Bind(wx.EVT_BUTTON, self.config_dht_click) self.new_gpio_btn = wx.Button(self, label='Add new relay device', pos=(15, 200), size=(175, 30)) self.new_gpio_btn.Bind(wx.EVT_BUTTON, self.add_new_device_relay) self.update_settings_btn = wx.Button(self, label='update pigrow settings', pos=(15, 235), size=(175, 30)) self.update_settings_btn.Bind(wx.EVT_BUTTON, self.update_setting_click)
def __init__( self, parent ): win_height = parent.GetSize()[1] win_width = parent.GetSize()[0] w_space_left = win_width - 285 wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = (285, 0), size = wx.Size(w_space_left , 800), style = wx.TAB_TRAVERSAL ) ## Draw UI elements png = wx.Image('./config_info.png', wx.BITMAP_TYPE_ANY).ConvertToBitmap() wx.StaticBitmap(self, -1, png, (0, 0), (png.GetWidth(), png.GetHeight())) #SDcard details config_info_pnl.boxname_text = wx.TextCtrl(self, pos=(25, 150), size=(265,65)) config_info_pnl.location_text = wx.StaticText(self, label='locations', pos=(520, 120), size=(200,30)) config_info_pnl.config_text = wx.StaticText(self, label='config', pos=(520, 185), size=(200,30)) config_info_pnl.lamp_text = wx.StaticText(self, label='lamp', pos=(10, 330), size=(200,30)) config_info_pnl.dht_text = wx.StaticText(self, label='dht', pos=(10, 415), size=(200,30)) config_info_pnl.gpio_table = self.GPIO_list(self, 1) config_info_pnl.gpio_table.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.onDoubleClick_GPIO)
def __init__( self, parent ): win_height = parent.GetSize()[1] height_of_pannels_above = 230 space_left = win_height - height_of_pannels_above wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = (0, height_of_pannels_above), size = wx.Size(285, space_left), style = wx.TAB_TRAVERSAL ) wx.StaticText(self, label='Cron Config Menu', pos=(25, 10)) self.read_cron_btn = wx.Button(self, label='Read Crontab', pos=(10, 40), size=(175, 30)) self.read_cron_btn.Bind(wx.EVT_BUTTON, self.read_cron_click) self.new_cron_btn = wx.Button(self, label='New cron job', pos=(10, 80), size=(175, 30)) self.new_cron_btn.Bind(wx.EVT_BUTTON, self.new_cron_click) self.update_cron_btn = wx.Button(self, label='Update Cron', pos=(10, 120), size=(175, 30)) self.update_cron_btn.Bind(wx.EVT_BUTTON, self.update_cron_click) self.SetBackgroundColour('sea green') #TESTING ONLY REMOVE WHEN SIZING IS DONE AND ALL THAT BUSINESS bSizer = wx.BoxSizer(wx.VERTICAL) bSizer.Add(self.read_cron_btn, 0, wx.ALL, 5) bSizer.Add(self.new_cron_btn, 0, wx.ALL, 5) bSizer.Add(self.update_cron_btn, 0, wx.ALL, 5) self.SetSizer(bSizer)
def __init__( self, parent ): #find size win_height = parent.GetSize()[1] win_width = parent.GetSize()[0] w_space_left = win_width - 285 wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = (285, 0), size = wx.Size(w_space_left , 800), style = wx.TAB_TRAVERSAL ) wx.StaticText(self, label='Cron start up;', pos=(5, 10)) cron_list_pnl.startup_cron = self.startup_cron_list(self, 1, pos=(5, 40), size=(w_space_left-10, 200)) cron_list_pnl.startup_cron.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.onDoubleClick_startup) wx.StaticText(self, label='Repeating Jobs;', pos=(5,245)) cron_list_pnl.repeat_cron = self.repeating_cron_list(self, 1, pos=(5, 280), size=(w_space_left-10, 200)) cron_list_pnl.repeat_cron.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.onDoubleClick_repeat) wx.StaticText(self, label='One time triggers;', pos=(5,500)) cron_list_pnl.timed_cron = self.other_cron_list(self, 1, pos=(5, 530), size=(w_space_left-10, 200)) cron_list_pnl.timed_cron.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.onDoubleClick_timed) # TESTING CODE WHILE SCRIPT WRITING IS IN PROGRESS self.SetBackgroundColour('sea green') ###THIS IS JUST TO TEST SIZE REMOVE TO STOP THE UGLY
def InitUI(self): #draw the pannel wx.StaticText(self, label='Select elements to upload from local storage to pi\n\n ** Warning this will overwrite current pigrow files \n which may result in loss of data **', pos=(30, 5)) self.cb_conf = wx.CheckBox(self, label='Config',pos = (80,90)) self.cb_logs = wx.CheckBox(self, label='Logs',pos = (80,115)) self.cb_cron = wx.CheckBox(self, label='Crontab',pos = (80,140)) self.cb_pics = wx.CheckBox(self, label='Photos',pos = (80,165)) self.cb_graph = wx.CheckBox(self, label='Graphs',pos = (80,190)) #right side self.cb_all = wx.CheckBox(self, label='Restore Back up\nof whole Pigrow Folder',pos = (270,130)) #progress bar wx.StaticText(self, label='uploading from; '+ localfiles_info_pnl.local_path, pos=(15, 215)) self.current_file_txt = wx.StaticText(self, label='--', pos=(30, 245)) self.current_dest_txt = wx.StaticText(self, label='--', pos=(30, 270)) #buttons self.start_upload_btn = wx.Button(self, label='Upload files', pos=(40, 300), size=(175, 50)) self.start_upload_btn.Bind(wx.EVT_BUTTON, self.start_upload_click) self.close_btn = wx.Button(self, label='Close', pos=(415, 300), size=(175, 50)) self.close_btn.Bind(wx.EVT_BUTTON, self.OnClose) ## universal controls pnl = wx.Panel(self)
def __init__( self, parent ): wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = (0,0), size = wx.Size( 285,190 ), style = wx.TAB_TRAVERSAL ) self.SetBackgroundColour((150,230,170)) #TESTING ONLY REMOVE WHEN SIZING IS DONE AND ALL THAT BUSINESS pi_link_pnl.target_ip = '' pi_link_pnl.target_user = '' pi_link_pnl.target_pass = '' pi_link_pnl.config_location_on_pi = '/home/pi/Pigrow/config/pigrow_config.txt' ## the three boxes for pi's connection details, IP, Username and Password self.l_ip = wx.StaticText(self, label='address', pos=(10, 20)) self.tb_ip = wx.TextCtrl(self, pos=(125, 25), size=(150, 25)) self.tb_ip.SetValue("192.168.1.") self.l_user = wx.StaticText(self, label='Username', pos=(10, 60)) self.tb_user = wx.TextCtrl(self, pos=(125, 60), size=(150, 25)) self.tb_user.SetValue("pi") self.l_pass = wx.StaticText(self, label='Password', pos=(10, 95)) self.tb_pass = wx.TextCtrl(self, pos=(125, 95), size=(150, 25)) self.tb_pass.SetValue("raspberry") ## link with pi button self.link_with_pi_btn = wx.Button(self, label='Link to Pi', pos=(10, 125), size=(175, 30)) self.link_with_pi_btn.Bind(wx.EVT_BUTTON, self.link_with_pi_btn_click) self.link_status_text = wx.StaticText(self, label='-- no link --', pos=(25, 160)) ## seek next pi button self.seek_for_pigrows_btn = wx.Button(self, label='Seek next', pos=(190,125)) self.seek_for_pigrows_btn.Bind(wx.EVT_BUTTON, self.seek_for_pigrows_click)
def __init__(self, parent): wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER) vbox = wx.BoxSizer(wx.VERTICAL) title = StaticTextNew(self, label="Bin Numpy Array") title.SetToolTipNew("Input array will be binned "+os.linesep+"according to the values below.") 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) title2 = wx.StaticText(self, label="Bin dimensions: ") vbox.Add(title2 ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.bdims=[{} for i in range(3)] self.bdims[0] = SpinnerObject(self,"x",MAX_INT_16,1,1,1,20,60) self.bdims[1] = SpinnerObject(self,"y",MAX_INT_16,1,1,1,20,60) self.bdims[2] = SpinnerObject(self,"z",MAX_INT_16,1,1,1,20,60) hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add(self.bdims[0], 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=10) hbox.Add(self.bdims[1], 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=10) hbox.Add(self.bdims[2], 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=10) vbox.Add(hbox, 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="Filter array with median filter.") vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.input_filename = TextPanelObject(self, "Input File: ", "",150,'*.npy') vbox.Add(self.input_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.output_filename = TextPanelObject(self, "Output File: ", "output.npy",150,'*.npy') vbox.Add(self.output_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) title2 = wx.StaticText(self, label="Filter kernel dimensions: ") vbox.Add(title2 ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.kdims=[{} for i in range(3)] self.kdims[0] = SpinnerObject(self,"x",MAX_INT_16,1,1,3,20,60) self.kdims[1] = SpinnerObject(self,"y",MAX_INT_16,1,1,3,20,60) self.kdims[2] = SpinnerObject(self,"z",MAX_INT_16,1,1,1,20,60) hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add(self.kdims[0], 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=10) hbox.Add(self.kdims[1], 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=10) hbox.Add(self.kdims[2], 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=10) vbox.Add(hbox, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.maxdev = SpinnerObject(self,"Normal deviation:",MAX_INT_16,0.0,0.1,0.5,150,150) self.maxdev.label.SetToolTipNew("Maximum element-wise normal deviation.") vbox.Add(self.maxdev, 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 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, parent): self.start_iter = None wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER) vbox = wx.BoxSizer(wx.VERTICAL) title = wx.StaticText(self, label="HIO Algorithm") vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.exp_amps = TextPanelObject(self, "Exp Amp: ", "",100,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") vbox.Add(self.exp_amps, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.chkbox_sqrt_expamps = wx.CheckBox(self, -1, 'Square Root Exp Amp', (50, 10)) self.chkbox_sqrt_expamps.SetValue(True) vbox.Add(self.chkbox_sqrt_expamps, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=5) self.support = TextPanelObject(self,"Support: ","",100,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") self.support.label.SetToolTipNew("Support. If empty, previous instance will be used.") vbox.Add(self.support, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.beta = SpinnerObject(self,"Beta: ",1.0,0.0,0.01,0.9,100,100) vbox.Add(self.beta, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.niter = SpinnerObject(self,"Iterations: ",MAX_INT,1,1,1,100,100) vbox.Add(self.niter, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.SetAutoLayout(True) self.SetSizer( vbox )
def __init__(self, parent): self.start_iter = None wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER) vbox = wx.BoxSizer(wx.VERTICAL) title = wx.StaticText(self, label="ER Algorithm") vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.exp_amps = TextPanelObject(self, "Exp Amp: ", "",100,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") vbox.Add(self.exp_amps, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.chkbox_sqrt_expamps = wx.CheckBox(self, -1, 'Square Root Exp Amp', (50, 10)) self.chkbox_sqrt_expamps.SetValue(True) vbox.Add(self.chkbox_sqrt_expamps, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=5) self.support = TextPanelObject(self,"Support: ","",100,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") self.support.label.SetToolTipNew("Support. If empty, previous instance will be used.") vbox.Add(self.support, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) #self.mask = TextPanelObject(self,"Mask: ","",100,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") #vbox.Add(self.mask, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.niter = SpinnerObject(self,"Iterations: ",MAX_INT,1,1,1,100,100) vbox.Add(self.niter, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.SetAutoLayout(True) self.SetSizer( vbox )
def __init__(self, parent): self.start_iter = None wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER) vbox = wx.BoxSizer(wx.VERTICAL) title = wx.StaticText(self, label="Phase-Only Algorithm") vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.exp_amps = TextPanelObject(self, "Exp Amp: ", "",100,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") vbox.Add(self.exp_amps, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.chkbox_sqrt_expamps = wx.CheckBox(self, -1, 'Square Root Exp Amp', (50, 10)) self.chkbox_sqrt_expamps.SetValue(True) vbox.Add(self.chkbox_sqrt_expamps, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=5) self.support = TextPanelObject(self,"Support: ","",100,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") self.support.label.SetToolTipNew("Support. If empty, previous instance will be used.") vbox.Add(self.support, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.mask = TextPanelObject(self,"Mask: ","",100,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") vbox.Add(self.mask, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.niter = SpinnerObject(self,"Iterations: ",MAX_INT,1,1,1,100,100) vbox.Add(self.niter, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.SetAutoLayout(True) self.SetSizer( vbox )
def __init__(self, parent): self.start_iter = None wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER) vbox = wx.BoxSizer(wx.VERTICAL) title = wx.StaticText(self, label="HIO Algorithm with positivity constraint") vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.exp_amps = TextPanelObject(self, "Exp Amp: ", "",100,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") vbox.Add(self.exp_amps, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.chkbox_sqrt_expamps = wx.CheckBox(self, -1, 'Square Root Exp Amp', (50, 10)) self.chkbox_sqrt_expamps.SetValue(True) vbox.Add(self.chkbox_sqrt_expamps, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=5) self.support = TextPanelObject(self,"Support: ","",100,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") self.support.label.SetToolTipNew("Support. If empty, previous instance will be used.") vbox.Add(self.support, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.mask = TextPanelObject(self,"Mask: ","",100,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") vbox.Add(self.mask, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.beta = SpinnerObject(self,"Beta: ",1.0,0.0,0.01,0.9,100,100) vbox.Add(self.beta, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.niter = SpinnerObject(self,"Iterations: ",MAX_INT,1,1,1,100,100) vbox.Add(self.niter, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.SetAutoLayout(True) self.SetSizer( vbox )
def __init__(self, parent): """Constructor""" self.notUseDetaul = None wx.Panel.__init__(self, parent=parent, size = (500,800)) B = wx.StaticBox(self, -1) BSizer = wx.StaticBoxSizer(B, wx.VERTICAL) self.imagesDir = os.path.join(".", "images") self.screenShotDir = os.path.join(".", "screenShot") self.defaultScreenShotImage = wx.Image(os.path.join(self.imagesDir, "default.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.screenShot = wx.StaticBitmap(self,-1, self.defaultScreenShotImage) self.screenShot.Bind(wx.EVT_LEFT_DOWN, self.DrawOrReloadAll) self.statusBar = wx.StaticText(self, -1, "") BSizer.Add(self.statusBar) BSizer.Add(self.screenShot,5,wx.EXPAND, 5) self.SetSizer(BSizer) pub.subscribe(self.updateStatus, "update") pub.subscribe(self.DrawFromSelectedNode, "DrawFromSelectedNode") pub.subscribe(self.DoSwipeOrInput, "DoSwipeOrInput") self.hasDrew = False
def __init__(self,parent,slidername,**kwargs): wx.Panel.__init__(self,parent,**kwargs) sliderlabel = wx.StaticText(self,-1,label=slidername+':',size=(50,-1)) self.slidertext = wx.TextCtrl(self,-1,style=wx.TE_PROCESS_ENTER, size=(50,-1)) self.slider = JumpSlider(self) #self.slider = wx.Slider(self) spintext = wx.StaticText(self,-1,label=u"\u00B1",size=(10,-1)) self.spin = wx.SpinCtrl(self,value='0',initial=0,size=(50,-1)) hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add(sliderlabel,0,wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 10) hbox.Add(self.slidertext,0,wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 10) hbox.Add(self.slider,1,wx.EXPAND,0) hbox.Add(spintext,0,wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 10) hbox.Add(self.spin,0,wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 10) vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(hbox,1,wx.EXPAND,0) self.SetSizer(vbox) self.SetValue(0)
def __init__(self,parent,**kwargs): wx.Panel.__init__(self,parent,**kwargs) self.componenttitle = wx.StaticText(self,-1,label='Component',size=(100,-1)) self.componentcombobox = wx.ComboBox(self, size=(10,-1), value='0') choices = ['0','1','2'] self.normaltitle = wx.StaticText(self,-1,label='Normal', size=(100,-1)) self.normalcombobox = wx.ComboBox(self, choices=choices, size=(10,-1), value='0') grid = wx.GridBagSizer(hgap=3) grid.Add(self.componenttitle, (0,0), flag=wx.EXPAND) grid.Add(self.componentcombobox, (1,0), flag=wx.EXPAND) grid.Add(self.normaltitle, (0,1), flag=wx.EXPAND) grid.Add(self.normalcombobox, (1,1), flag=wx.EXPAND) grid.AddGrowableCol(0) grid.AddGrowableCol(1) self.SetSizer(grid)
def add_num(self, rang, accu, title, key, unit): sizer = wx.BoxSizer( wx.HORIZONTAL ) lab_title = wx.StaticText( self, wx.ID_ANY, title, wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE ) lab_title.Wrap( -1 ) sizer.Add( lab_title, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) ctrl = NumCtrl(self, rang, accu) self.ctrl_dic[key] = ctrl ctrl.Bind(wx.EVT_KEY_UP, lambda x : self.para_changed(key)) sizer.Add( ctrl, 2, wx.ALL, 5 ) lab_unit = wx.StaticText( self, wx.ID_ANY, unit, wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE ) lab_unit.Wrap( -1 ) sizer.Add( lab_unit, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.tus.append((lab_title, lab_unit)) self.lst.Add( sizer, 0, wx.EXPAND, 5 )
def add_color(self, title, key, unit): sizer = wx.BoxSizer( wx.HORIZONTAL ) lab_title = wx.StaticText( self, wx.ID_ANY, title, wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE ) lab_title.Wrap( -1 ) sizer.Add( lab_title, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) ctrl = ColorCtrl(self) self.ctrl_dic[key] = ctrl ctrl.Bind(wx.EVT_KEY_UP, lambda x : self.para_changed(key)) sizer.Add( ctrl, 2, wx.ALL, 5 ) lab_unit = wx.StaticText( self, wx.ID_ANY, unit, wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE ) lab_unit.Wrap( -1 ) sizer.Add( lab_unit, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.tus.append((lab_title, lab_unit)) self.lst.Add( sizer, 0, wx.EXPAND, 5 )
def add_slide(self, rang, title, key, unit): sizer = wx.BoxSizer( wx.HORIZONTAL ) lab_title = wx.StaticText( self, wx.ID_ANY, title, wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE ) lab_title.Wrap( -1 ) sizer.Add( lab_title, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) iswin = platform.system() == 'Windows' lab = wx.SL_VALUE_LABEL if iswin else wx.SL_LABELS ctrl = wx.Slider( self, wx.ID_ANY, 50, rang[0], rang[1], wx.DefaultPosition, wx.Size( -1,-1 ), wx.SL_HORIZONTAL|lab ) self.ctrl_dic[key] = ctrl ctrl.Bind(wx.EVT_SCROLL, lambda x : self.para_changed(key)) sizer.Add( ctrl, 2, wx.ALL, 5 ) lab_unit = wx.StaticText( self, wx.ID_ANY, unit, wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE ) lab_unit.Wrap( -1 ) sizer.Add( lab_unit, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.tus.append((lab_title, lab_unit)) self.lst.Add( sizer, 0, wx.EXPAND, 5 )
def add_txt(self, title, key, unit): sizer = wx.BoxSizer( wx.HORIZONTAL ) lab_title = wx.StaticText( self, wx.ID_ANY, title, wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE ) lab_title.Wrap( -1 ) sizer.Add( lab_title, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) ctrl = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) self.ctrl_dic[key] = ctrl ctrl.Bind( wx.EVT_KEY_UP, lambda x : self.para_changed(key)) sizer.Add( ctrl, 2, wx.ALL, 5 ) lab_unit = wx.StaticText( self, wx.ID_ANY, unit, wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE ) lab_unit.Wrap( -1 ) sizer.Add( lab_unit, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.tus.append((lab_title, lab_unit)) self.lst.Add( sizer, 0, wx.EXPAND, 5 )
def rgb(self, hist): panel = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) back = wx.BoxSizer( wx.VERTICAL ) back.Add(panel, 1, wx.EXPAND) sizer = wx.BoxSizer( wx.VERTICAL ) rgb = ['Red', 'Green', 'Blue'] for i in (0,1,2): histc = HistCanvas(panel) histc.set_hist(hist[i]) txt = wx.StaticText( panel, wx.ID_ANY, 'Channel:'+ rgb[i], wx.DefaultPosition, wx.DefaultSize, 0 ) sizer.Add( txt, 0, wx.LEFT|wx.RIGHT, 8 ) sizer.Add( histc, 0, wx.LEFT|wx.RIGHT, 8 ) mean, lim = np.dot(hist[i], range(256))/hist[i].sum(), np.where(hist[i]>0)[0] sta = 'Statistic: Mean:%s Min:%s Max:%s'%(mean.round(1), lim.min(), lim.max()) txt = wx.StaticText( panel, wx.ID_ANY, sta, wx.DefaultPosition, wx.DefaultSize, 0 ) sizer.Add( txt, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM, 8 ) panel.SetSizer( sizer ) self.SetSizer(back) self.Fit()
def gray(self, hist): panel = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) back = wx.BoxSizer( wx.VERTICAL ) back.Add(panel, 1, wx.EXPAND) sizer = wx.BoxSizer( wx.VERTICAL ) histc = HistCanvas(panel) histc.set_hist(hist) txt = wx.StaticText( panel, wx.ID_ANY, 'Channel:'+'Gray', wx.DefaultPosition, wx.DefaultSize, 0 ) sizer.Add( txt, 0, wx.LEFT|wx.RIGHT, 8 ) sizer.Add( histc, 0, wx.LEFT|wx.RIGHT, 8 ) mean, lim = np.dot(hist, range(256))/hist.sum(), np.where(hist>0)[0] sta = 'Statistic: Mean:%s Min:%s Max:%s'%(mean.round(1), lim.min(), lim.max()) txt = wx.StaticText( panel, wx.ID_ANY, sta, wx.DefaultPosition, wx.DefaultSize, 0 ) sizer.Add( txt, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM, 8 ) panel.SetSizer( sizer ) self.SetSizer(back) self.Fit()
def __init__(self, parent): # begin wxGlade: CE_TE.__init__ #kwds["style"] = wx.CLOSE_BOX|wx.MINIMIZE_BOX wx.Dialog.__init__(self, parent,id=-1,title="CE and TE") self.parent=parent self.label_1 = wx.StaticText(self, -1, "Max_CE") self.text_ctrl_1 = wx.TextCtrl(self, -1, "") self.label_2 = wx.StaticText(self, -1, "Max_TE") self.text_ctrl_2 = wx.TextCtrl(self, -1, "") self.button_1 = wx.Button(self, -1, "OK") self.button_2 = wx.Button(self, -1, "Cancel") self.__set_properties() self.__do_layout() self.Bind(wx.EVT_TEXT_ENTER, self.On_TE_Enter, self.text_ctrl_1) self.Bind(wx.EVT_TEXT, self.On_CE_Text, self.text_ctrl_1) self.Bind(wx.EVT_TEXT_ENTER, self.On_TE_Enter, self.text_ctrl_2) self.Bind(wx.EVT_TEXT, self.On_TE_Text, self.text_ctrl_2) self.Bind(wx.EVT_BUTTON, self.On_Ok, self.button_1) self.Bind(wx.EVT_BUTTON, self.On_Cancel, self.button_2) # end wxGlade
def __init__(self, *args, **kwds): # begin wxGlade: secret_win.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.label_1 = wx.StaticText(self, -1, "School Name") self.text_ctrl_1 = wx.TextCtrl(self, -1, "") self.label_2 = wx.StaticText(self, -1, "School Code") self.text_ctrl_2 = wx.TextCtrl(self, -1, "") self.button_1 = wx.Button(self, -1, "Save") self.DB=db_operations() self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.on_save, self.button_1) self.on_load() self.Center() # end wxGlade
def __init__(self, *args, **kwds): # begin wxGlade: sms_dialoge.__init__ kwds["style"] = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.MAXIMIZE_BOX | wx.THICK_FRAME wx.Frame.__init__(self, *args, **kwds) self.panel_5 = wx.Panel(self, wx.ID_ANY) self.label_7 = wx.StaticText(self.panel_5, wx.ID_ANY, ("Username")) self.combo_box_1 = wx.ComboBox(self.panel_5, wx.ID_ANY, choices=[("Select"), ("admin"), ("teacher")], style=wx.CB_READONLY|wx.CB_DROPDOWN) self.label_8 = wx.StaticText(self.panel_5, wx.ID_ANY, ("Password")) self.text_ctrl_1 = wx.TextCtrl(self.panel_5, wx.ID_ANY, "", style=wx.TE_PASSWORD) self.button_1 = wx.Button(self.panel_5, wx.ID_ANY, ("Cancel")) self.button_2 = wx.Button(self.panel_5, wx.ID_ANY, ("Login")) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_COMBOBOX, self.on_user, self.combo_box_1) self.Bind(wx.EVT_TEXT, self.on_text, self.text_ctrl_1) self.Bind(wx.EVT_BUTTON, self.on_cancel, self.button_1) self.Bind(wx.EVT_BUTTON, self.on_login, self.button_2) self.text_ctrl_1.Bind(wx.EVT_KEY_DOWN, self.OnKeyPress) self.Bind(wx.EVT_CLOSE,self.on_close,self) self.UO=user_operations(self) # end wxGlade
def __init__(self, *args, **kwds): # begin wxGlade: add_academic_year.__init__ kwds["style"] = wx.DEFAULT_DIALOG_STYLE wx.Dialog.__init__(self, *args, **kwds) self.label_3 = wx.StaticText(self, wx.ID_ANY, ("Academic Year")) self.text_ctrl_1 = wx.TextCtrl(self, wx.ID_ANY, "") self.label_4 = wx.StaticText(self, wx.ID_ANY, ("-")) self.text_ctrl_2 = wx.TextCtrl(self, wx.ID_ANY, "") self.button_close = wx.Button(self, wx.ID_ANY, ("Close")) self.button_add = wx.Button(self, wx.ID_ANY, ("Add")) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_TEXT, self.on_enter, self.text_ctrl_1) self.Bind(wx.EVT_BUTTON, self.on_close, self.button_close) self.Bind(wx.EVT_BUTTON, self.on_add, self.button_add) self.text_ctrl_1.Bind(wx.EVT_KEY_DOWN, self.handle_keypress) self.NEW_YEAR='' # end wxGlade
def __init__( self, parent, id, titlemsg ): wx.Dialog.__init__( self, parent, id, title=titlemsg ) MechList = [] for m in parent.ScoreServer.MechList.List: MechList.append( str(m.ID) + ": " + str(m.Name) ) self.MechText = wx.StaticText( self, -1, "Mech Selection:" ) self.MechChoice = wx.ListBox( self, -1, style=wx.LB_EXTENDED, choices=MechList ) self.CancelButton = wx.Button( self, wx.ID_CANCEL, "Cancel" ) self.OKButton = wx.Button( self, wx.ID_OK, "OK" ) TopSizer = wx.BoxSizer( wx.VERTICAL ) BtnSizer = wx.BoxSizer( wx.HORIZONTAL ) BtnSizer.Add( self.CancelButton, 0, wx.ALL, 5 ) BtnSizer.Add( self.OKButton, 0, wx.ALL, 5 ) TopSizer.Add( self.MechText, 0, wx.ALL, 5 ) TopSizer.Add( self.MechChoice, 0, wx.ALL, 5 ) TopSizer.Add( BtnSizer, 0, wx.ALL|wx.CENTER, 5 ) self.SetSizer( TopSizer ) TopSizer.Fit( self )
def __init__(self, parent): wx.Frame.__init__(self, parent, title=u"My Frame") self.model = WatchableDict() self.model["text"] = "" sizer = wx.BoxSizer(wx.VERTICAL) self.text_ctrl = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) sizer.Add(self.text_ctrl, 0, 0, 0) pywatch.wx.ValueChanger(self.text_ctrl, self.model, "text") self.static_text = wx.StaticText(self, wx.ID_ANY, u"Text: {0}", wx.DefaultPosition, wx.DefaultSize, 0) sizer.Add(self.static_text, 0, 0, 0) pywatch.wx.LabelWatcher(self.static_text, self.model, "text") self.SetSizer(sizer) self.Centre(wx.BOTH)
def __init__(self, parent, title = u"KUON FONT TOOL"): wx.Frame.__init__(self, parent, -1, title,pos=(150, 150), size=(400, 360)) panel = wx.Panel(self, -1) self.button = wx.Button(panel, -1, u"??????", pos=(50, 20)) wx.StaticText(panel ,-1 ,u"??????" ,(200, 20)) self.Bind(wx.EVT_BUTTON, self.OnClick_expng,self.button) self.button.SetDefault() self.button1 = wx.Button(panel, -1, u"?????", pos=(50, 60)) wx.StaticText(panel ,-1 ,u"?????" ,(200, 60)) self.Bind(wx.EVT_BUTTON, self.OnClick_excharlist,self.button1) self.button1.SetDefault() self.button2 = wx.Button(panel, -1, u"??????", pos=(50, 100)) wx.StaticText(panel ,-1 ,u"??????" ,(200, 100)) self.Bind(wx.EVT_BUTTON, self.OnClick_exfont_info,self.button2) self.button2.SetDefault() self.button3 = wx.Button(panel, -1, u"??????", pos=(50, 140)) wx.StaticText(panel ,-1 ,u"??????" ,(200, 140)) self.Bind(wx.EVT_BUTTON, self.OnClick_buildfont,self.button3) self.button3.SetDefault() self.Show()
def OnInit(self): """ Run automatically when the wxPython application starts. """ self.frame = wx.Frame(None, title="PyUpdater wxPython Demo") self.frame.Bind(wx.EVT_CLOSE, self.OnCloseFrame) self.frame.SetSize(wx.Size(400, 100)) self.statusBar = wx.StatusBar(self.frame) self.statusBar.SetStatusText(self.status) self.frame.SetStatusBar(self.statusBar) self.panel = wx.Panel(self.frame) self.sizer = wx.BoxSizer() self.sizer.Add( wx.StaticText(self.frame, label="Version %s" % __version__)) self.panel.SetSizerAndFit(self.sizer) self.frame.Show() if hasattr(sys, "frozen") and \ not os.environ.get('PYUPDATER_FILESERVER_DIR'): dlg = wx.MessageDialog( self.frame, "The PYUPDATER_FILESERVER_DIR environment variable " "is not set!", "PyUpdaterWxDemo File Server Error", wx.OK | wx.ICON_ERROR) dlg.ShowModal() return True
def __init__(self, *args, **kwds): # begin wxGlade: ChatFrameGui.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.panel_2 = wx.Panel(self, -1, style=wx.RAISED_BORDER|wx.TAB_TRAVERSAL) self.panel_1 = wx.Panel(self, -1, style=wx.RAISED_BORDER|wx.TAB_TRAVERSAL) self.panel_3 = wx.Panel(self.panel_1, -1) self.panel_4 = wx.Panel(self.panel_1, -1) self.frmMain_statusbar = self.CreateStatusBar(1) self.lblIpAddress = wx.StaticText(self.panel_4, -1, "IP &Address") self.edtIPAddress = wx.TextCtrl(self.panel_4, -1, "127.0.0.1") self.spnConnectPort = wx.SpinCtrl(self.panel_4, -1, "8080", min=1, max=65535, style=wx.SP_ARROW_KEYS|wx.SP_WRAP) self.btnConnect = wx.ToggleButton(self.panel_4, -1, "&Connect") self.lblListenPort = wx.StaticText(self.panel_3, -1, "Listen &on port") self.spnListenPort = wx.SpinCtrl(self.panel_3, -1, "8080", min=1, max=65535, style=wx.SP_ARROW_KEYS|wx.SP_WRAP) self.btnListen = wx.ToggleButton(self.panel_3, -1, "Lis&ten") self.lblReceived = wx.StaticText(self.panel_1, -1, "Received") self.edtReceived = wx.TextCtrl(self.panel_1, -1, "", style=wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_RICH2|wx.TE_AUTO_URL) self.lblSent = wx.StaticText(self.panel_1, -1, "Sent:") self.edtSent = wx.TextCtrl(self.panel_1, -1, "", style=wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_RICH2|wx.TE_AUTO_URL) self.edtToSend = wx.TextCtrl(self.panel_2, -1, "") self.btnSend = wx.Button(self.panel_2, -1, "&Send") self.btnClose = wx.Button(self.panel_2, -1, "&Close") self.__set_properties() self.__do_layout() # end wxGlade
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 ) #----------------------------------------------------------
def createHeading(self, panel, headingText): hbox = wx.BoxSizer(wx.HORIZONTAL) pathHeading = wx.StaticText(panel, label=headingText) pathHeading.SetFont(self.fontHeading) hbox.Add(pathHeading, flag=wx.RIGHT|wx.EXPAND, border=0) return hbox