我们从Python开源项目中,提取了以下16个代码示例,用于说明如何使用wx.StaticLine()。
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): wx.Frame.__init__(self, None, wx.ID_ANY, title='Testcase') v_sizer = wx.BoxSizer(wx.VERTICAL) v_sizer.Add(wx.StaticText(self, -1, "Some misc information"), 0) v_sizer.AddSpacer((0, 20), 0) v_sizer.Add(FilePicker(self), 0, wx.EXPAND) v_sizer.AddSpacer((0, 0), 1, wx.EXPAND) sticky_history = [os.path.expanduser('~'), os.path.expanduser('~/Dropbox'), os.path.expanduser('~/Documents')] v_sizer.Add(wx.StaticLine(self, -1, style=wx.LI_HORIZONTAL), 0, wx.EXPAND|wx.ALL, 5) file_picker1 = FilePicker(self, allow_glob_matching=True, title='glob match') v_sizer.Add(file_picker1, 0, wx.EXPAND) history = sticky_history[:] v_sizer.Add(wx.StaticLine(self, -1, style=wx.LI_HORIZONTAL), 0, wx.EXPAND|wx.ALL, 5) self.dir_picker = FilePicker(self, is_files_not_dirs=False, history=history) self.file_picker = FilePicker(self, assumed_prefix=os.path.expanduser('~/'), allow_glob_matching=True, title='glob match') self.dir_picker.on_load = self.file_picker.set_assumed_prefix self.file_picker.on_load = self.file_picker_on_load v_sizer.Add(self.dir_picker, 0, wx.EXPAND) v_sizer.AddSpacer((0, 10), 0, wx.EXPAND) v_sizer.Add(self.file_picker, 0, wx.EXPAND) v_sizer.Add(wx.StaticLine(self, -1, style=wx.LI_HORIZONTAL), 0, wx.EXPAND|wx.ALL, 5) v_sizer.AddSpacer((0, 0), 1, wx.EXPAND) v_sizer.Add(FilePicker(self, sticky_history=sticky_history), 0, wx.EXPAND) v_sizer.AddSpacer((0, 0), 1, wx.EXPAND) self.SetSizer(v_sizer)
def add_tools(bar, datas, curids=[]): ##! TODO: ## datas? dirpath tree to generate menus/toolsbar? ## curids? ?? box = bar.GetSizer() if curids!=None: for curid in curids: bar.RemoveChild(curid) box.Hide(curid) box.Detach(curid) if curids!=None: del curids[:] for data in datas: btn = wx.BitmapButton(bar, wx.ID_ANY, make_bitmap(wx.Bitmap(data[1])), wx.DefaultPosition, (32,32), wx.BU_AUTODRAW|wx.RAISED_BORDER ) if curids!=None: curids.append(btn) if curids==None: box.Add(btn) else: box.Insert(len(box.GetChildren())-2, btn) btn.Bind( wx.EVT_LEFT_DOWN, lambda x, p=data[0]:f(p(), x)) btn.Bind( wx.EVT_ENTER_WINDOW, lambda x, p='"{}" Tool'.format(data[0].title): set_info(p)) if not isinstance(data[0], Macros) and issubclass(data[0], Tool): btn.Bind(wx.EVT_LEFT_DCLICK, lambda x, p=data[0]:p().show()) btn.SetDefault() box.Layout() bar.Refresh() if curids==None: sp = wx.StaticLine( bar, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_VERTICAL ) box.Add( sp, 0, wx.ALL|wx.EXPAND, 2 ) box.AddStretchSpacer(1)
def __init__( self, parent ): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = 'ImagePy', size = wx.Size(-1,-1), pos = wx.DefaultPosition, style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) logopath = os.path.join(root_dir, 'data/logo.ico') #self.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_3DLIGHT ) ) self.SetIcon(wx.Icon(logopath, wx.BITMAP_TYPE_ICO)) self.SetSizeHints( wx.Size( 600,-1 ), wx.DefaultSize ) IPy.curapp = self # Todo:Fixed absolute/relative path! # print("menuspath:{}".format( os.path.join(root_dir,"menus"))) # print("toolspath:{}".format(os.path.join(root_dir,"tools")) # menuspath = os.path.join(root_dir, "menus") # toolspath = os.path.join(root_dir,"tools") self.menubar = pluginloader.buildMenuBarByPath(self, 'menus') self.SetMenuBar( self.menubar ) self.shortcut = pluginloader.buildShortcut(self) self.SetAcceleratorTable(self.shortcut) sizer = wx.BoxSizer(wx.VERTICAL) self.toolbar = toolsloader.build_tools(self, 'tools') #self.toolbar.Realize() #sizertool.Add(self.toolbar, 1, 0, 5 ) #sizertool.Add(self.morebar, 0, 0, 5) sizer.Add(self.toolbar, 0, wx.EXPAND, 5 ) #sizer.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) self.line_color = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) #self.line_color.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_HIGHLIGHT ) ) sizer.AddStretchSpacer(prop=1) sizer.Add(self.line_color, 0, wx.EXPAND |wx.ALL, 0 ) stapanel = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) sizersta = wx.BoxSizer( wx.HORIZONTAL ) self.txt_info = wx.StaticText( stapanel, wx.ID_ANY, "ImagePy v0.2", wx.DefaultPosition, wx.DefaultSize, 0 ) self.txt_info.Wrap( -1 ) #self.txt_info.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_INFOBK ) ) sizersta.Add( self.txt_info, 1, wx.ALIGN_BOTTOM|wx.BOTTOM|wx.LEFT|wx.RIGHT, 2 ) self.pro_bar = wx.Gauge( stapanel, wx.ID_ANY, 100, wx.DefaultPosition, wx.Size( 100,15 ), wx.GA_HORIZONTAL ) sizersta.Add( self.pro_bar, 0, wx.ALIGN_BOTTOM|wx.BOTTOM|wx.LEFT|wx.RIGHT, 2 ) stapanel.SetSizer(sizersta) stapanel.SetDropTarget(FileDrop()) sizer.Add(stapanel, 0, wx.EXPAND, 5 ) self.SetSizer( sizer ) self.Centre( wx.BOTH ) self.Layout() self.Fit() self.update = False self.Bind(wx.EVT_CLOSE, self.on_close) thread = threading.Thread(None, self.hold, ()) thread.setDaemon(True) thread.start()
def __init__(self, *args, **kwds): # begin wxGlade: delete.__init__ kwds["style"] = wx.MAXIMIZE | wx.CLOSE_BOX | wx.THICK_FRAME|wx.CAPTION wx.Dialog.__init__(self, *args, **kwds) self.panel_2 = wx.ScrolledWindow(self, -1, style=wx.TAB_TRAVERSAL) self.label_1 = wx.StaticText(self.panel_2, -1, "Specify Class") self.combo_box_1 = wx.ComboBox(self.panel_2, -1, choices=[], style=wx.CB_DROPDOWN | wx.CB_READONLY ) self.combo_box_2 = wx.ComboBox(self.panel_2, -1, choices=["Select Standard", "8", "9", "10"], style=wx.CB_DROPDOWN | wx.CB_READONLY ) self.combo_box_3 = wx.ComboBox(self.panel_2, -1, choices=['Select Division'], style=wx.CB_DROPDOWN | wx.CB_READONLY ) self.static_line_2 = wx.StaticLine(self.panel_2, -1) self.panel_1 = wx.Panel(self.panel_2, -1) self.check_list_box_1 = wx.CheckListBox(self.panel_1, -1, (60, 50), (30,30), ['Admission No Name']) self.check_list_box_2 = wx.CheckListBox(self.panel_1, -1, (60, 50), wx.DefaultSize, []) self.button_close = wx.Button(self.panel_2, -1, "Close") self.button_proceed = wx.Button(self.panel_2, -1, "Proceed") self.__set_properties() self.__do_layout() self.Bind(wx.EVT_COMBOBOX, self.oncombo_year, self.combo_box_1) self.Bind(wx.EVT_COMBOBOX, self.oncombo_class, self.combo_box_2) self.Bind(wx.EVT_COMBOBOX, self.oncombo_div, self.combo_box_3) self.Bind(wx.EVT_CHECKLISTBOX, self.on_check, self.check_list_box_1) self.Bind(wx.EVT_CHECKLISTBOX, self.on_check_2, self.check_list_box_2) self.Bind(wx.EVT_BUTTON, self.on_close, self.button_close) self.Bind(wx.EVT_BUTTON, self.on_proceed, self.button_proceed) self.checkedItems=() self.DB=db_operations() self.load_year() # end wxGlade
def set_data(self, faces, res_tot, size=util.MAX_THUMBNAIL_SIZE): """Set the data.""" self.sizer.Clear(True) static_text_title = wx.StaticText( self, label='Find {} Similar Candidate Faces Results:'.format( len(faces))) self.sizer.Add(static_text_title, 0, wx.EXPAND) for mode in ('matchPerson', 'matchFace'): static_text_caption = wx.StaticText( self, label='{} Mode:'.format(mode)) self.sizer.Add(static_text_caption, 0, wx.EXPAND) for face_id, face in faces.iteritems(): static_line = wx.StaticLine(self) self.sizer.Add(static_line, 0, wx.EXPAND) bitmap = MyStaticBitmap(self, face.bmp, size=size) self.sizer.Add(bitmap, 0, wx.ALIGN_LEFT) static_text = wx.StaticText( self, label='Similar Faces Ranked by Similarity') self.sizer.Add(static_text, 0, wx.ALIGN_LEFT) confidence_face_list = WrapCaptionFaceList( self, res_tot[mode][face_id]) self.sizer.Add(confidence_face_list, 0, wx.EXPAND) self.SetSizerAndFit(self.sizer)
def createWidgets(self): instructions = 'Browse for an image' img = wx.Image(240,240) self.imageCtrl = wx.StaticBitmap(self.panel, wx.ID_ANY, wx.Bitmap(img)) instructLbl = wx.StaticText(self.panel, label=instructions) self.photoTxt = wx.TextCtrl(self.panel, size=(200,-1)) browseBtn = wx.Button(self.panel, label='Browse') browseBtn.Bind(wx.EVT_BUTTON, self.onBrowse) self.mainSizer = wx.BoxSizer(wx.VERTICAL) self.sizer = wx.BoxSizer(wx.HORIZONTAL) self.mainSizer.Add(wx.StaticLine(self.panel, wx.ID_ANY), 0, wx.ALL|wx.EXPAND, 5) self.mainSizer.Add(instructLbl, 0, wx.ALL, 5) self.mainSizer.Add(self.imageCtrl, 0, wx.ALL, 5) self.sizer.Add(self.photoTxt, 0, wx.ALL, 5) self.sizer.Add(browseBtn, 0, wx.ALL, 5) self.mainSizer.Add(self.sizer, 0, wx.ALL, 5) self.panel.SetSizer(self.mainSizer) self.mainSizer.Fit(self.frame) self.panel.Layout()
def create_wxwindow(self): if self.thickness is not None: if self.style & wx.LI_HORIZONTAL: self.size = (-1, self.thickness) elif self.style & wx.LI_VERTICAL: self.size = (self.thickness, -1) return self.initfn(wx.StaticLine)(self.parent, self.id, self.pos, self.size, self.style, self.name)
def __init__( self, parent, ID, title, size=wx.DefaultSize, pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE, fields=None, data=None, ): wx.Dialog.__init__ (self, parent, ID, title, pos, size, style) sizer = wx.BoxSizer(wx.VERTICAL) self.textctrls = {} for field in fields: box = wx.BoxSizer(wx.HORIZONTAL) label = wx.StaticText(self, -1, field) label.SetHelpText("This is the help text for the label") box.Add(label, 1, wx.ALIGN_CENTRE|wx.ALL, 5) text = wx.TextCtrl(self, -1, "", size=(80,-1)) text.SetHelpText("Here's some help text for field #1") if field in data: text.SetValue(repr(data[field])) box.Add(text, 1, wx.ALIGN_CENTRE|wx.ALL, 1) sizer.Add(box, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 1) self.textctrls[field] = text line = wx.StaticLine(self, -1, size=(20,-1), style=wx.LI_HORIZONTAL) sizer.Add(line, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.RIGHT|wx.TOP, 5) btnsizer = wx.StdDialogButtonSizer() btn = wx.Button(self, wx.ID_OK) btn.SetHelpText("The OK button completes the dialog") btn.SetDefault() btnsizer.AddButton(btn) btn = wx.Button(self, wx.ID_CANCEL) btn.SetHelpText("The Cancel button cancels the dialog. (Cool, huh?)") btnsizer.AddButton(btn) btnsizer.Realize() sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) self.SetSizer(sizer) sizer.Fit(self)
def InitUI(self): self.panel = wx.Panel(self, wx.ID_ANY) # Info Text infotext = _(u'Close all open Applications, it is possible that programs will be closed without a warning ' u'and system could reboot without further confirmation.') infobox = wx.StaticBox(self.panel, -1, _(u'Attention')) infoboxbsizer = wx.StaticBoxSizer(infobox, wx.VERTICAL) info = wx.StaticText(self.panel, label=infotext) info.Wrap(380) infoboxbsizer.Add(info, 0) self.gauge = wx.Gauge(self.panel, size=(24, 26)) self.update_label = wx.StaticText(self.panel, label=_(u'Current Progress:')) self.update_box = wx.TextCtrl(self.panel, style=wx.TE_READONLY) self.update_box.SetBackgroundColour(wx.WHITE) self.chk_shutdown = wx.CheckBox(self.panel, size=(160,20), label=_(u"Shutdown after update")) self.logButton = wx.Button(self.panel, size=(54,26), label="LOG") self.logButton.SetToolTip(wx.ToolTip(_(u'Open WPKG Log'))) self.logButton.SetBitmap(img.get('log')) self.startButton = wx.Button(self.panel, label=_(u"Update")) self.abortButton = wx.Button(self.panel, label=_(u"Cancel")) self.logButton.Disable() self.abortButton.Disable() self.line = wx.StaticLine(self.panel, -1, size=(2,2), style=wx.LI_HORIZONTAL) self.startButton.Bind(wx.EVT_BUTTON, self.OnStartButton) self.abortButton.Bind(wx.EVT_BUTTON, self.OnAbortButton) self.logButton.Bind(wx.EVT_BUTTON, self.OnLogButton) self.sizer = wx.BoxSizer(wx.VERTICAL) self.sizer2 = wx.BoxSizer(wx.HORIZONTAL) self.sizer.Add(infoboxbsizer, 0, wx.ALL | wx.EXPAND, 5) self.sizer.Add(self.gauge, 0, wx.ALL | wx.EXPAND, 5) self.sizer.Add(self.update_label, 0, wx.ALL | wx.EXPAND, 5) self.sizer.Add(self.update_box, 0, wx.ALL | wx.EXPAND, 5) self.sizer.Add(self.line, 0, wx.ALL | wx.EXPAND, 5) self.sizer.Add(self.chk_shutdown, 0, wx.LEFT | wx.EXPAND, 7) self.sizer2.Add(self.logButton, 0) self.sizer2.AddStretchSpacer() self.sizer2.Add(self.startButton, 0)#, wx.RIGHT, 2) self.sizer2.Add(self.abortButton, 0) self.sizer.Add(self.sizer2, 0, wx.ALL | wx.EXPAND, 5) self.panel.SetSizerAndFit(self.sizer) self.Center()
def __init__(self, *args, **kwds): # begin wxGlade: student_profie.__init__ kwds["style"] = wx.CAPTION | wx.CLOSE_BOX | wx.MINIMIZE_BOX | wx.MAXIMIZE | wx.MAXIMIZE_BOX | wx.SYSTEM_MENU | wx.RESIZE_BORDER | wx.CLIP_CHILDREN wx.Frame.__init__(self, *args, **kwds) self.panel_1 = wx.Panel(self, wx.ID_ANY, style=wx.RAISED_BORDER | wx.TAB_TRAVERSAL) self.combo_box_13 = wx.ComboBox(self.panel_1, wx.ID_ANY, choices=[], style=wx.CB_DROPDOWN) self.combo_box_14 = wx.ComboBox(self.panel_1, wx.ID_ANY, choices=[], style=wx.CB_DROPDOWN) self.combo_box_15 = wx.ComboBox(self.panel_1, wx.ID_ANY, choices=[], style=wx.CB_DROPDOWN) self.button_1 = wx.Button(self.panel_1, wx.ID_ANY, _("Add New")) self.text_ctrl_1 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "", style=wx.TE_PROCESS_ENTER | wx.TE_CENTRE) self.bitmap_button_2 = wx.BitmapButton(self.panel_1, wx.ID_ANY, wx.Bitmap("/media/ghssvythiri/10C63D64C63D4AEC/asif/sqlite_working_aug_16/Resources/img/pass.jpg", wx.BITMAP_TYPE_ANY), style=wx.BU_AUTODRAW) self.static_line_1 = wx.StaticLine(self.panel_1, wx.ID_ANY) self.bitmap_button_1 = wx.BitmapButton(self.panel_1, wx.ID_ANY, wx.Bitmap("/media/ghssvythiri/10C63D64C63D4AEC/asif/sqlite_working_aug_16/Resources/img/exit.jpg", wx.BITMAP_TYPE_ANY)) self.label_1 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Name")) self.label_2 = wx.StaticText(self.panel_1, wx.ID_ANY, _("UID")) self.label_3 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Gender")) self.text_ctrl_2 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "") self.text_ctrl_3 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "") self.combo_box_16 = wx.ComboBox(self.panel_1, wx.ID_ANY, choices=[], style=wx.CB_DROPDOWN) self.label_4 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Date of Birth")) self.label_5 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Category")) self.label_6 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Reigion")) self.text_ctrl_4 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "") self.text_ctrl_5 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "") self.text_ctrl_6 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "") self.label_7 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Caste")) self.label_8 = wx.StaticText(self.panel_1, wx.ID_ANY, _("First Language")) self.label_9 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Father")) self.text_ctrl_7 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "") self.text_ctrl_8 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "") self.text_ctrl_9 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "") self.label_10 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Mother")) self.label_11 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Mobile")) self.label_12 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Email")) self.text_ctrl_10 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "") self.text_ctrl_11 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "") self.text_ctrl_12 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "") self.hyperlink_1 = wx.HyperlinkCtrl(self.panel_1, wx.ID_ANY, "", "") self.hyperlink_2 = wx.HyperlinkCtrl(self.panel_1, wx.ID_ANY, "", "") self.hyperlink_3 = wx.HyperlinkCtrl(self.panel_1, wx.ID_ANY, "", "") self.static_line_2 = wx.StaticLine(self.panel_1, wx.ID_ANY) self.button_3 = wx.Button(self.panel_1, wx.ID_ANY, _("Delete")) self.button_2 = wx.Button(self.panel_1, wx.ID_ANY, _("Close")) self.button_4 = wx.Button(self.panel_1, wx.ID_ANY, _("Save")) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.on_search, self.bitmap_button_2) # end wxGlade
def __init__(self, *args, **kwds): # begin wxGlade: promote.__init__ kwds["style"] = wx.CAPTION | wx.CLOSE_BOX | wx.MINIMIZE_BOX | wx.SYSTEM_MENU | wx.RESIZE_BORDER | wx.TAB_TRAVERSAL | wx.CLIP_CHILDREN wx.Dialog.__init__(self, *args, **kwds) self.panel_2 = wx.ScrolledWindow(self, -1, style=wx.TAB_TRAVERSAL) self.label_10 = wx.StaticText(self.panel_2, -1, "Current Class Details") self.combo_box_1 = wx.ComboBox(self.panel_2, -1, choices=[], style=wx.CB_DROPDOWN | wx.CB_SIMPLE | wx.CB_DROPDOWN | wx.CB_READONLY) self.combo_box_2 = wx.ComboBox(self.panel_2, -1, choices=["Select Standard", "8", "9", "10"], style=wx.CB_DROPDOWN | wx.CB_SIMPLE | wx.CB_DROPDOWN | wx.CB_READONLY) self.combo_box_3 = wx.ComboBox(self.panel_2, -1, choices=['Select Division'], style=wx.CB_DROPDOWN | wx.CB_SIMPLE | wx.CB_DROPDOWN | wx.CB_READONLY) self.static_line_1 = wx.StaticLine(self.panel_2, -1, style=wx.LI_VERTICAL) self.label_11 = wx.StaticText(self.panel_2, -1, "Promote/Move To") self.combo_box_4 = wx.ComboBox(self.panel_2, -1, choices=[], style=wx.CB_DROPDOWN | wx.CB_SIMPLE | wx.CB_DROPDOWN | wx.CB_READONLY) self.combo_box_5 = wx.ComboBox(self.panel_2, -1, choices=["Select Standard", "8", "9", "10"], style=wx.CB_DROPDOWN | wx.CB_SIMPLE | wx.CB_DROPDOWN | wx.CB_READONLY) self.combo_box_6 = wx.ComboBox(self.panel_2, -1, choices=['Select Division'], style=wx.CB_DROPDOWN | wx.CB_SIMPLE | wx.CB_DROPDOWN | wx.CB_READONLY) self.static_line_2 = wx.StaticLine(self.panel_2, -1) self.panel_1 = wx.Panel(self.panel_2, -1) allLoc = ['Admission No Name'] self.check_list_box_1 = wx.CheckListBox(self.panel_1, -1, (60, 50), (30,30), allLoc) self.check_list_box_2 = wx.CheckListBox(self.panel_1, -1, (60, 50), wx.DefaultSize, []) #self.list_box_2 = wx.ListBox(self.panel_1, -1, choices=[]) #self.list_box_3 = wx.ListBox(self.panel_1, -1, choices=[]) self.button_cancel = wx.Button(self.panel_2, -1, "Close") self.button_proceed = wx.Button(self.panel_2, -1, "Proceed") self.__set_properties() self.__do_layout() self.Bind(wx.EVT_COMBOBOX, self.oncombo_year1, self.combo_box_1) self.Bind(wx.EVT_COMBOBOX, self.oncombo_class1, self.combo_box_2) self.Bind(wx.EVT_COMBOBOX, self.oncombo_div1, self.combo_box_3) self.Bind(wx.EVT_COMBOBOX, self.oncombo_year2, self.combo_box_4) self.Bind(wx.EVT_COMBOBOX, self.oncombo_class2, self.combo_box_5) self.Bind(wx.EVT_COMBOBOX, self.oncombo_div2, self.combo_box_6) self.Bind(wx.EVT_CHECKLISTBOX, self.on_check, self.check_list_box_1) self.Bind(wx.EVT_CHECKLISTBOX, self.on_check_2, self.check_list_box_2) self.Bind(wx.EVT_BUTTON, self.on_cancel, self.button_cancel) self.Bind(wx.EVT_BUTTON, self.on_proceed, self.button_proceed) self.checkedItems=() self.DB=db_operations() self.load_year(self.combo_box_1 ,self.combo_box_2 ,self.combo_box_3 ) self.load_year(self.combo_box_4 ,self.combo_box_5 ,self.combo_box_6 ) # end wxGlade
def __init__( self, parent, id ): wx.Panel.__init__( self, parent ) self.ScoreServer = parent.ScoreServer self.Match = self.ScoreServer.Match self.MechList = self.ScoreServer.Match.MechList # Create a MatchTimeText self.MatchTimerText = MatchTimerText( self, -1, self.Match ) self.MatchTimerText.SetFont(wx.Font(50, wx.DEFAULT, wx.NORMAL, wx.BOLD)) # Create a Sizer, NameText, and HPText for each Mech in the match. self.MechSizer = [] self.MechNameText = [] self.MechHPText = [] for m in xrange(len(self.MechList)): self.MechSizer.append( wx.BoxSizer( wx.HORIZONTAL ) ) self.MechNameText.append( wx.StaticText( self, -1, self.MechList[m].Name ) ) self.MechHPText.append( MechHPText( self, -1, self.ScoreServer, self.MechList[m] ) ) self.MechNameText[m].SetFont(wx.Font(30, wx.DEFAULT, wx.NORMAL, wx.BOLD)) self.MechHPText[m].SetFont(wx.Font(30, wx.DEFAULT, wx.NORMAL, wx.BOLD)) # Create an overall sizer for the panel. self.Sizer = wx.BoxSizer( wx.VERTICAL ) # Add TimerText to the panel's sizer. self.Sizer.Add( self.MatchTimerText, proportion=0, flag=wx.ALL|wx.ALIGN_CENTER, border=10 ) self.Sizer.Add( wx.StaticLine( self ), 0, wx.ALL|wx.EXPAND, 5 ) # Add all Mech Sizers to the panel's sizer for m in xrange(len(self.MechList)): # Insert a "VS" static text between teams if this is not a FFA match. if self.Match.MatchType != MWScore.MATCH_FFA: if self.MechList[m].Team != self.MechList[m-1].Team and m != 0: vstext = wx.StaticText(self, -1, "VS") vstext.SetFont(wx.Font(30, wx.DEFAULT, wx.NORMAL, wx.BOLD)) self.Sizer.Add( vstext, proportion=0, flag=wx.ALL|wx.ALIGN_CENTER, border=10 ) self.MechSizer[m].Add( self.MechNameText[m], proportion=0, flag=wx.RIGHT, border=10 ) self.MechSizer[m].Add( self.MechHPText[m], proportion=0, flag=wx.LEFT, border=10 ) self.Sizer.Add( self.MechSizer[m], proportion=0, flag=wx.ALL|wx.ALIGN_CENTER, border=10 ) # Set panel's sizer and fit. self.SetSizer( self.Sizer ) self.Sizer.Fit( parent ) # Refresh the TimeText and all instances of MechHPText
def __init__(self, add_book, *args, **kwargs): """ initilizer for the main from for the AddressBook app. :param add_book: the address book class to manipulate :type add_book: A address_book_data.AddressBook instance """ kwargs.setdefault('title', "Micro Address Book") wx.Frame.__init__(self, *args, **kwargs) self.add_book = add_book self.current_index = 0 # creae a status bar for messages... self.CreateStatusBar() # create the entryPanel self.entryPanel = AddBookForm(add_book.book[self.current_index], self) # put them in a Sizer to lay out S = wx.BoxSizer(wx.VERTICAL) S.Add(wx.StaticLine(self,style=wx.LI_HORIZONTAL), 0, wx.EXPAND) S.Add(self.entryPanel, 0, wx.ALL|wx.EXPAND, 4) S.Add((1,5)) S.Add(wx.StaticLine(self,style=wx.LI_HORIZONTAL), 0, wx.EXPAND) self.SetSizerAndFit(S) # Build up the menu bar: menuBar = wx.MenuBar() fileMenu = wx.Menu() closeMenuItem = fileMenu.Append(wx.ID_EXIT, "&Close", "Close the file" ) self.Bind(wx.EVT_MENU, self.onClose, closeMenuItem) exitMenuItem = fileMenu.Append(wx.ID_EXIT, "Exit", "Exit the application") self.Bind(wx.EVT_MENU, self.onExit, exitMenuItem) menuBar.Append(fileMenu, "&File") helpMenu = wx.Menu() helpMenuItem = helpMenu.Append(wx.ID_HELP, "Help", "Get help") menuBar.Append(helpMenu, "&Help") self.SetMenuBar(menuBar)