我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用wx.Panel()。
def __init__( self, parent ): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"Encrypted Files", pos = wx.DefaultPosition, size = wx.Size( 600,400 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize ) BodySizer = wx.BoxSizer( wx.VERTICAL ) self.m_panel4 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) TextCtrlSizer = wx.BoxSizer( wx.VERTICAL ) self.EncryptedFilesTextCtrl = wx.TextCtrl( self.m_panel4, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_DONTWRAP|wx.TE_MULTILINE|wx.TE_READONLY ) TextCtrlSizer.Add( self.EncryptedFilesTextCtrl, 1, wx.ALL|wx.EXPAND, 5 ) self.m_panel4.SetSizer( TextCtrlSizer ) self.m_panel4.Layout() TextCtrlSizer.Fit( self.m_panel4 ) BodySizer.Add( self.m_panel4, 1, wx.EXPAND |wx.ALL, 5 ) self.SetSizer( BodySizer ) self.Layout() self.Centre( wx.BOTH )
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): wx.Panel.__init__(self, parent) imageFile = 'Tile.bmp' self.bmp = wx.Bitmap(imageFile) # react to a resize event and redraw image parent.Bind(wx.EVT_SIZE, self.canvasCallback) menu = wx.Menu() menu.Append(wx.ID_ABOUT, "About", "wxPython GUI") menu.AppendSeparator() menu.Append(wx.ID_EXIT, "Exit", " Exit the GUI") menuBar = wx.MenuBar() menuBar.Append(menu, "File") parent.SetMenuBar(menuBar) self.textWidget = wx.TextCtrl(self, size=(280, 80), style=wx.TE_MULTILINE) button = wx.Button(self, label="Create OpenGL 3D Cube", pos=(60, 100)) self.Bind(wx.EVT_BUTTON, self.buttonCallback, button) parent.CreateStatusBar()
def __init__(self, parent): wx.Panel.__init__(self, parent) menu = wx.Menu() menu.Append(wx.ID_ABOUT, "About", "wxPython GUI") menu.AppendSeparator() menu.Append(wx.ID_EXIT, "Exit", " Exit the GUI") menuBar = wx.MenuBar() menuBar.Append(menu, "File") parent.SetMenuBar(menuBar) self.textWidget = wx.TextCtrl(self, size=(280, 80), style=wx.TE_MULTILINE) button = wx.Button(self, label="Create OpenGL 3D Cube", pos=(60, 100)) self.Bind(wx.EVT_BUTTON, self.buttonCallback, button) parent.CreateStatusBar()
def __init__(self, parent, browser,model = None): wx.Panel.__init__(self, parent, -1) panel = wx.Panel(self, -1) self.dvc = dv.DataViewCtrl(self, style=wx.BORDER_THEME | dv.DV_ROW_LINES # | dv.DV_VERT_RULES | dv.DV_MULTIPLE ) self.Sizer = wx.BoxSizer(wx.VERTICAL) self.Sizer.Add(self.dvc, 1, wx.EXPAND) self.browser = browser self.WindowsSize = wx.GetClientDisplayRect() if self.browser: self.browser.set_window_size(self.WindowsSize[2]/2, (self.WindowsSize[3])) self.browser.set_window_position(self.WindowsSize[2]/2, 0) self.dvc.Bind(dv.EVT_DATAVIEW_ITEM_ACTIVATED, self.OnOpenGooleChrome) self.dvc.Bind(dv.EVT_DATAVIEW_SELECTION_CHANGED, self.OnSelectionChanged) self.url = ""
def __init__(self, parent,nbresult,lf,rt): wx.Panel.__init__(self, parent, -1) panel = wx.Panel(self, -1) self.nbResult = nbresult self.lf = lf self.rt = rt hbox1 = wx.BoxSizer(wx.HORIZONTAL) self.UrlTxtCtrl = wx.TextCtrl(self, -1, "http://news.china.com.cn", style = wx.TE_PROCESS_ENTER) btnStart = wx.Button(self, -1, "?", (20,20)) #¼ #Onstart = frame.OnStart self.Bind(wx.EVT_BUTTON, self.OnStart, btnStart) hbox1.Add(self.UrlTxtCtrl, 1, wx.EXPAND) hbox1.Add(btnStart,0, wx.EXPAND) self.SetSizer(hbox1)
def __init__(self, parent,start): wx.Panel.__init__(self, parent, -1) self.start = start panel = wx.Panel(self, -1) hbox2 = wx.BoxSizer(wx.HORIZONTAL) self.NumTxtCtrl = wx.TextCtrl(self, -1, " ?v0.1.4", style = wx.TE_PROCESS_ENTER|wx.TE_READONLY) self.severule = wx.Button(self, -1, "" ,(20,20)) self.btnClear = wx.Button(self, -1, "?" ,(20,20)) self.btnParseURL = wx.Button(self, -1, "URL" ,(20,20)) self.btnParseContent = wx.Button(self, -1, "?" ,(20,20)) #sizer hbox2.Add(self.NumTxtCtrl,1, wx.EXPAND) hbox2.Add(self.severule,0, wx.EXPAND) hbox2.Add(self.btnClear,0, wx.EXPAND) hbox2.Add(self.btnParseURL,0, wx.EXPAND) hbox2.Add(self.btnParseContent,0, wx.EXPAND) self.SetSizer(hbox2) ##?¼ self.Bind(wx.EVT_BUTTON, self.start.OnRemoveCache, self.btnClear) self.Bind(wx.EVT_BUTTON, self.start.OnSeveResult, self.severule) self.Bind(wx.EVT_BUTTON, self.start.OnStart, self.btnParseURL) self.Bind(wx.EVT_BUTTON, self.start.OnStart, self.btnParseContent)
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 __init__(self, parent=None, default_directory="", monitor_directory=False): wx.Panel.__init__(self, parent) self._sizer = wx.BoxSizer(wx.HORIZONTAL) directory_label = wx.StaticText(self, label="Default directory") directory_label.SetToolTipString("Default directory to scan for uploads") self._sizer.Add(directory_label, flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, border=5, proportion=0) directory = wx.DirPickerCtrl(self, path=default_directory) self.Bind(wx.EVT_DIRPICKER_CHANGED, lambda evt: send_message(SettingsDialog.field_changed_topic, field_name="default_dir", field_value=directory.GetPath())) self._sizer.Add(directory, flag=wx.EXPAND, proportion=1) monitor_checkbox = wx.CheckBox(self, label="Monitor directory for new runs?") monitor_checkbox.SetValue(monitor_directory) monitor_checkbox.SetToolTipString("Monitor the default directory for when the Illumina Software indicates that the analysis is complete and ready to upload (when CompletedJobInfo.xml is written to the directory).") monitor_checkbox.Bind(wx.EVT_CHECKBOX, lambda evt: send_message(SettingsDialog.field_changed_topic, field_name="monitor_default_dir", field_value=str(monitor_checkbox.GetValue()))) self._sizer.Add(monitor_checkbox, flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT, border=5, proportion=0) self.SetSizerAndFit(self._sizer) self.Layout()
def __init__(self, size=(300, 300), pos=(100, 100)): wx.Frame.__init__(self, None, title="Am I transparent?", style=wx.SIMPLE_BORDER | wx.STAY_ON_TOP | wx.FRAME_NO_TASKBAR) self.SetClientSize(size) self.SetPosition(pos) self.alphaValue = 220 self.alphaIncrement = -4 pnl = wx.Panel(self) # self.changeAlpha_timer = wx.Timer(self) # self.changeAlpha_timer.Start(50) # self.Bind(wx.EVT_TIMER, self.ChangeAlpha) self.MakeTransparent(self.alphaValue) self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
def __init__(self, *args, **kwargs): """Construct a new panel containing configuration widgets. Args: parent: Parent in wx hierarchy. pg: Page to be configured. *args, **kwargs: Additional arguments passed to the wx.Panel base class. """ StandardConfigPanel.__init__(self, *args, **kwargs) self.initMediaPath() self.initNTrial() self.initIntervals() self.initSegWindow() self.initClassifierKind() self.initStandardLayout()
def __init__(self, parent, pg, *args, **kwargs): """Construct a new panel containing configuration widgets. Args: parent: Parent in wx hierarchy. pg: Page to be configured. *args, **kwargs: Additional arguments passed to the wx.Panel base class. """ StandardConfigPanel.__init__(self, parent=parent, pg=pg, *args, **kwargs) self.initCopy() self.initNTrial() self.initIntervals() self.initSegWindow() self.initColors() self.initGridLayout() self.initClassifier() self.initStandardLayout()
def __init__(self, *args, **kwargs): """Construct a new panel containing configuration widgets. Args: parent: Parent in wx hierarchy. pg: Page to be configured. *args, **kwargs: Additional arguments passed to the wx.Panel base class. """ StandardConfigPanel.__init__(self, *args, **kwargs) self.initRobot() self.initNTrial() self.initIntervals() self.initSegWindow() self.initClassifierKind() self.initStandardLayout()
def __init__(self, parent, src, orient=wx.HORIZONTAL, *args, **kwargs): """Initialize a new source configuration panel. Args: parent: wx parent of this panel. src: Source to configure. args, kwargs: Additional arguments to pass to the wx.Panel base class constructor. """ wx.Panel.__init__(self, parent=parent, *args, **kwargs) self.src = src self.sizer = wx.BoxSizer(orient=orient) self.SetSizer(self.sizer)
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 __init__(self, parent, size=wx.Size(128,128), dpi=None, **kwargs): self.size = size self.dragging_curview_is_active = False wx.Panel.__init__(self, parent, wx.ID_ANY, wx.DefaultPosition, size, 0, **kwargs) self.ztv_frame = self.GetTopLevelParent() self.figure = Figure(None, dpi) self.axes = self.figure.add_axes([0., 0., 1., 1.]) self.curview_rectangle = Rectangle((0, 0), 1, 1, color='orange', fill=False, zorder=100) self.axes.add_patch(self.curview_rectangle) self.canvas = FigureCanvasWxAgg(self, -1, self.figure) self.overview_zoom_factor = 1. self._SetSize() self.set_xy_limits() self.axes_widget = AxesWidget(self.figure.gca()) self.axes_widget.connect_event('button_press_event', self.on_button_press) self.axes_widget.connect_event('button_release_event', self.on_button_release) self.axes_widget.connect_event('motion_notify_event', self.on_motion) pub.subscribe(self.redraw_overview_image, 'redraw-image') pub.subscribe(self.redraw_box, 'primary-xy-limits-changed')
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="Sum or Subtract Arrays") title.SetToolTipNew("Sum or subtract array2 from array 1") vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.input_filename = TextPanelObject(self, "Input File 1: ", "",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.input_filename1 = TextPanelObject(self, "Input File 2: ", "",150,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") vbox.Add(self.input_filename1, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.output_filename = TextPanelObject(self, "Output File: ", "output.npy",150,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") vbox.Add(self.output_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.addsub = RadioBoxNew(self, label="Add or Subtract:", choices=['Add','Subtract'], majorDimension=2, style=wx.RA_SPECIFY_COLS) self.addsub.SetToolTipNew("Add or Subtract") vbox.Add(self.addsub, 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 = StaticTextNew(self, label="Rotate Support Array") title.SetToolTipNew("Rotate support (binary complex) arrays only. \nStrange results will ensue if used on data arrays.") 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: ", "data_rotated.npy",150,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") vbox.Add(self.output_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.rotationaxis = SpinnerObject(self,"Axis:",3,1,1,1,150,150) self.rotationaxis.label.SetToolTipNew("Rotation axis.") vbox.Add(self.rotationaxis, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.rotationangle = SpinnerObject(self,"Angle:",360,-360,1,0,150,150) self.rotationangle.label.SetToolTipNew("Rotation angle in degrees.") vbox.Add(self.rotationangle, 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="Create binary mask from Numpy array") 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: ", "mask.npy",150,'*.npy') vbox.Add(self.output_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.max = SpinnerObject(self,"Maximum Value:",MAX_INT,MIN_INT,1.0,MAX_INT,150,150) self.max.label.SetToolTipNew("Data within the min/max range "+os.linesep+"will result in a non-zero mask value.") self.min = SpinnerObject(self,"Minimum Value:",MAX_INT,MIN_INT,1,50.0,150,150) self.min.label.SetToolTipNew("Data within the min/max range "+os.linesep+"will result in a non-zero mask value.") vbox.Add(self.max, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) vbox.Add(self.min, 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 = 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 = StaticTextNew(self, label="Threshold data in Numpy array") title.SetToolTipNew("Data outside range is set to zero.") 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: ", "data_thresh.npy",150,'*.npy') vbox.Add(self.output_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.max = SpinnerObject(self,"Maximum Value:",MAX_INT,MIN_INT,1.0,MAX_INT,150,150) self.max.label.SetToolTipNew("Data within the min/max range "+os.linesep+"will result in a non-zero mask value.") self.min = SpinnerObject(self,"Minimum Value:",MAX_INT,MIN_INT,1,50.0,150,150) self.min.label.SetToolTipNew("Data within the min/max range "+os.linesep+"will result in a non-zero mask value.") vbox.Add(self.max, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) vbox.Add(self.min, 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): wx.Panel.__init__(self, parent) self.panelvisual = self.GetParent().GetParent().GetParent() self.vbox = wx.BoxSizer(wx.VERTICAL) self.hbox_btn = wx.BoxSizer(wx.HORIZONTAL) self.chkbox_enable = CheckBoxNew(self, -1, 'Enable XYZ Axes') self.chkbox_enable.SetToolTipNew("Enable Widget") if self.panelvisual.widget.GetEnabled() == 0: self.chkbox_enable.SetValue(False) else: self.chkbox_enable.SetValue(True) self.Bind(wx.EVT_CHECKBOX, self.OnChkbox, self.chkbox_enable) self.hbox_btn.Add(self.chkbox_enable, 1, flag=wx.CENTER) self.vbox.Add(self.hbox_btn, 1, flag=wx.CENTER, border=2) self.SetSizer(self.vbox) self.Fit() self.Show()
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): """Constructor""" wx.Panel.__init__(self, parent=parent) B = wx.StaticBox(self, -1) self.BSizer = wx.StaticBoxSizer(B, wx.VERTICAL) self.tree = XMLTree(parent=self, ID=-1) self.tree.Bind(wx.EVT_TREE_SEL_CHANGED, self.onSelectItem) self.tree.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.getFullXpath) self.BSizer.Add(self.tree, 5, wx.EXPAND, 5) self.SetSizer(self.BSizer) cDir = os.getcwd() self.xmlPath = os.path.join(cDir,"Hierarchy","window_dump.xml") pub.subscribe(self.updateTree, "updateTree") pub.subscribe(self.setSelectedNode, "setSelectedNode") pub.subscribe(self.DoSearch, "DoSearch")
def __init__(self, parent): wx.Panel.__init__(self, parent, -1) # ????? self.response_text = wx.TextCtrl(self, -1, style=wx.TE_MULTILINE) response_sizer = wx.StaticBoxSizer(wx.StaticBox(self, -1, "Response")) response_sizer.Add(self.response_text, 1, wx.EXPAND) # ??????? self.doc_text = wx.TextCtrl(self, -1, style=wx.TE_MULTILINE | wx.TE_READONLY) doc_sizer = wx.StaticBoxSizer(wx.StaticBox(self, -1, "Document")) doc_sizer.Add(self.doc_text, 1, wx.EXPAND) main_box = wx.BoxSizer(wx.VERTICAL) main_box.Add(response_sizer, 1, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5) main_box.Add(doc_sizer, 1, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5) self.SetSizer(main_box) self.response_text.Bind(wx.EVT_CHAR, self.on_key_down) self.doc_text.Bind(wx.EVT_CHAR, self.on_key_down)
def __init__(self,parent,fdir,**kwargs): wx.Panel.__init__(self,parent,**kwargs) if (fdir[-1] != '/'): fdir+='/' self.fdir = fdir self.PP = All_PostProc(self.fdir) # Loop through all field classes and try to initialise at least one. # As fundametal classes typically return zeros on missing results # while DataNotAvailable error is returned for some complex classes for item in self.PP.plotlist.items(): try: self.initialise_visuals(item) #If successful, use the current object # if not then keep trying break except DataNotAvailable, ValueError: pass
def __init__(self, parent,**kwargs): wx.Panel.__init__(self,parent,**kwargs) self.parent = parent self.figure = matplotlib.figure.Figure() self.canvas = wxaggb.FigureCanvasWxAgg(self, -1, self.figure) self.sizer = wx.BoxSizer(wx.VERTICAL) self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW) self.Bind(wx.EVT_SIZE, self.sizeHandler) # canvas is your canvas, and root is your parent (Frame, TopLevel, Tk instance etc.) #self.zoomhandle = wxaggb.NavigationToolbar2WxAgg(self.canvas) #self.toolbar = wxb.NavigationToolbar2Wx(self.canvas) #self.toolbar.Realize() #self.toolbar.update() self.cmap = matplotlib.cm.RdYlBu_r
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 __init__(self,title): super(Frame,self).__init__(None,-1,title,style=wx.DEFAULT_FRAME_STYLE^wx.MAXIMIZE_BOX^wx.RESIZE_BORDER) self.colors = {0:(204,192,179),2:(238, 228, 218),4:(237, 224, 200),8:(242, 177, 121),16:(245, 149, 99),32:(246, 124, 95),64:(246, 94, 59),128:(237, 207, 114),256:(237, 207, 114),512:(237, 207, 114),1024:(237, 207, 114),2048:(237, 207, 114),4096:(237, 207, 114),8192:(237, 207, 114),16384:(237, 207, 114),32768:(237, 207, 114),65536:(237, 207, 114),131072:(237, 207, 114),262144:(237, 207, 114),524288:(237, 207, 114),1048576:(237, 207, 114),2097152:(237, 207, 114),4194304:(237, 207, 114),8388608:(237, 207, 114),16777216:(237, 207, 114)}#????????? self.setIcon() self.initGame() self.initBuffer() panel = wx.Panel(self) #?????? #------???? panel.Bind(wx.EVT_KEY_DOWN,self.onKeyDown) panel.SetFocus() #????? self.Bind(wx.EVT_SIZE,self.onSize) #use wx.BufferedPaintDC self.Bind(wx.EVT_PAINT,self.onPaint) self.Bind(wx.EVT_CLOSE,self.onClose) #???? #------ self.SetClientSize((505,720)) #?????? self.Center() #????? self.Show()
def _init_ctrls(self, prnt): wx.Panel.__init__(self, id=ID_SEARCHRESULTPANEL, name='SearchResultPanel', parent=prnt, pos=wx.Point(0, 0), size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL) self.HeaderLabel = wx.StaticText(id=ID_SEARCHRESULTPANELHEADERLABEL, name='HeaderLabel', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) search_results_tree_style = CT.TR_HAS_BUTTONS | CT.TR_NO_LINES | CT.TR_HAS_VARIABLE_ROW_HEIGHT self.SearchResultsTree = CT.CustomTreeCtrl(id=ID_SEARCHRESULTPANELSEARCHRESULTSTREE, name="SearchResultsTree", parent=self, pos=wx.Point(0, 0), style=search_results_tree_style) if wx.VERSION >= (2, 8, 11): self.SearchResultsTree.SetAGWWindowStyleFlag(search_results_tree_style) self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnSearchResultsTreeItemActivated, id=ID_SEARCHRESULTPANELSEARCHRESULTSTREE) self.ResetButton = wx.lib.buttons.GenBitmapButton( self, bitmap=GetBitmap("reset"), size=wx.Size(28, 28), style=wx.NO_BORDER) self.ResetButton.SetToolTipString(_("Reset search result")) self.Bind(wx.EVT_BUTTON, self.OnResetButton, self.ResetButton) self._init_sizers()
def _create_NetworkEditor(self, prnt): self.NetworkEditor = wx.Panel( id=-1, parent=prnt, pos=wx.Point(0, 0), size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL) NetworkEditorTemplate._init_ctrls(self, self.NetworkEditor) main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=1, vgap=0) main_sizer.AddGrowableCol(0) main_sizer.AddGrowableRow(0) main_sizer.AddWindow(self.NetworkNodes, 0, border=5, flag=wx.GROW | wx.ALL) self.NetworkEditor.SetSizer(main_sizer) return self.NetworkEditor
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