我们从Python开源项目中,提取了以下12个代码示例,用于说明如何使用wx.STAY_ON_TOP。
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 convert_update(self, message): progress = "{songs} out of {total}".format(songs=message // 2, total=self.num_songs) if self.progress_dialog and self.converter.isAlive(): if message >= self.num_songs * 2: message = self.num_songs * 2 - 1 if not self.progress_dialog.Update(value=message, newmsg="Converted: {prog}".format(prog=progress))[0]: self.converter.abort() self.converter.join() self.progress_dialog.Destroy() alert_string = "Aborted! Only {progress} songs were converted".format(progress=progress) alert = wx.MessageDialog(parent=self, message=alert_string, caption="pyjam", style=wx.ICON_EXCLAMATION) alert.ToggleWindowStyle(wx.STAY_ON_TOP) alert.ShowModal() alert.Destroy() logger.info("Audio conversion canceled canceled.") logger.info(progress) # wx.CallAfter(self.progress_dialog.Destroy)
def convert_complete(self, errors): if self.progress_dialog: self.converter.join() if errors: done_string = "Songs converted with {errors} error(s)".format(errors=len(errors)) else: done_string = "All songs were converted succesfully!" done_message = wx.MessageDialog(parent=self, message=done_string, caption="pyjam") done_message.ToggleWindowStyle(wx.STAY_ON_TOP) done_message.ShowModal() done_message.Destroy() if errors: errors = '\n'.join(errors) error_dialog = wx.MessageDialog(parent=self, message="The following files caused errors\n" + errors, caption="Conversion Error!", style=wx.OK | wx.ICON_ERROR) error_dialog.ShowModal() error_dialog.Destroy() logger.critical("Error converting these files\n{errors}".format(errors=errors)) logger.info(done_string) wx.CallAfter(self.progress_dialog.Destroy)
def __init__(self, *args, **kwds): # begin wxGlade: Add_Student.__init__ kwds["style"] = wx.CAPTION | wx.CLOSE_BOX | wx.MINIMIZE_BOX | wx.STAY_ON_TOP wx.Dialog.__init__(self, *args, **kwds) self.text_ctrl_1 = wx.TextCtrl(self, -1, "") self.text_ctrl_2 = wx.TextCtrl(self, -1, "") self.text_ctrl_3 = wx.TextCtrl(self, -1, "") self.button_1 = wx.Button(self, -1, "Add") self.Bind(wx.EVT_CLOSE,self.OnClose,self) self.__set_properties() self.__do_layout() self.DB=db_operations() self.success=False self.STUDENT_INFO=[] # end wxGlade
def __init__(self, *args, **kwds): # begin wxGlade: MyDialog.__init__ #args[ kwds["style"] = wx.CAPTION | wx.CLOSE_BOX | wx.STAY_ON_TOP wx.Dialog.__init__(self, *args, **kwds) self.text_ctrl_passwd = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_PASSWORD) self.button_cancel = wx.Button(self, wx.ID_ANY, _("Cancel")) self.button_ok = wx.Button(self, wx.ID_ANY, _("OK")) self.__set_properties() self.__do_layout() self.password_text='' self.Bind(wx.EVT_TEXT, self.on_passwod, self.text_ctrl_passwd) self.Bind(wx.EVT_BUTTON, self.on_button_cancel, self.button_cancel) self.Bind(wx.EVT_BUTTON, self.on_button_ok, self.button_ok) self.cancelled=False # end wxGlade
def InitUI(self): sb = wx.StaticText(self, label='Stop! Open or Create new project first!') ic = wx.ArtProvider.GetBitmap( wx.ART_TIP, size=(48,48) ) icn= wx.StaticBitmap(self,-1,ic,name='Stop') lbl_mt = wx.StaticText(self, label="") vbox = wx.BoxSizer(wx.VERTICAL) self.SetSizer(vbox) vbox.Add(lbl_mt,flag=wx.CENTER, border=2) vbox.Add(sb,flag=wx.CENTER, border=2) vbox.Add(icn,flag=wx.CENTER, border=0) hbox2 = wx.BoxSizer(wx.HORIZONTAL) OButton = wx.Button(self, label='Open') NButton = wx.Button(self, label='New') hbox2.Add(OButton, flag=wx.CENTER, border=2) hbox2.Add(NButton, flag=wx.LEFT, border=5) vbox.Add(hbox2,flag=wx.ALIGN_CENTER|wx.TOP|wx.BOTTOM, border=2) OButton.Bind(wx.EVT_BUTTON,self.OpenBtn) NButton.Bind(wx.EVT_BUTTON,self.NewBtn) self.Show() self.SetFocus() self.SetWindowStyle( wx.STAY_ON_TOP )
def check_for_update(self): def find_update(): logging.debug("Checking remote for new updates.") try: gh = GitHub() repo = gh.repository("phac-nml", "irida-miseq-uploader") # get the latest tag from github return next(repo.iter_tags(number=1)) except: logging.warn("Couldn't reach github to check for new version.") raise def handle_update(result): latest_tag = result.get() logging.debug("Found latest version: [{}]".format(latest_tag)) release_url = self.url + "/releases/latest" if LooseVersion(self.__app_version__) < LooseVersion(latest_tag.name): logging.info("Newer version found.") dialog = NewVersionMessageDialog( parent=None, id=wx.ID_ANY, message=("A new version of the IRIDA MiSeq " "Uploader tool is available. You can" " download the latest version from "), title="IRIDA MiSeq Uploader update available", download_url=release_url, style=wx.CAPTION|wx.CLOSE_BOX|wx.STAY_ON_TOP) dialog.ShowModal() dialog.Destroy() else: logging.debug("No new versions found.") dr.startWorker(handle_update, find_update)
def __init__(self, *args, **kwds): # begin wxGlade: sampoorna_win.__init__ kwds["style"] = wx.CAPTION | wx.CLOSE_BOX | wx.MINIMIZE_BOX | wx.MAXIMIZE | wx.MAXIMIZE_BOX | wx.STAY_ON_TOP | wx.SYSTEM_MENU | wx.RESIZE_BORDER | wx.CLIP_CHILDREN wx.Frame.__init__(self, *args, **kwds) self.panel_1 = wx.ScrolledWindow(self, wx.ID_ANY, style=wx.TAB_TRAVERSAL) self.panel_warning = wx.Panel(self.panel_1, wx.ID_ANY, style=wx.RAISED_BORDER | wx.STATIC_BORDER | wx.TAB_TRAVERSAL) self.label_1 = wx.StaticText(self.panel_warning, wx.ID_ANY, _("label_1")) self.panel_login = wx.Panel(self.panel_1, wx.ID_ANY) self.bitmap_1 = wx.StaticBitmap(self.panel_login, wx.ID_ANY, wx.Bitmap("/home/ghssvythiri/Desktop/about.jpeg", wx.BITMAP_TYPE_ANY)) self.label_2 = wx.StaticText(self.panel_login, wx.ID_ANY, _("label_2")) self.text_ctrl_1 = wx.TextCtrl(self.panel_login, wx.ID_ANY, "") self.label_3 = wx.StaticText(self.panel_login, wx.ID_ANY, _("label_3")) self.text_ctrl_2 = wx.TextCtrl(self.panel_login, wx.ID_ANY, "", style=wx.TE_PASSWORD) self.button_1 = wx.Button(self.panel_login, wx.ID_ANY, _("button_1")) self.panel_class = wx.Panel(self.panel_1, wx.ID_ANY) self.checkbox_1 = wx.CheckBox(self.panel_class, wx.ID_ANY, _("checkbox_1")) self.checkbox_2 = wx.CheckBox(self.panel_class, wx.ID_ANY, _("checkbox_2")) self.checkbox_3 = wx.CheckBox(self.panel_class, wx.ID_ANY, _("checkbox_3")) self.button_2 = wx.Button(self.panel_class, wx.ID_ANY, _("button_2")) self.panel_progress = wx.Panel(self.panel_1, wx.ID_ANY) self.panel_report = wx.Panel(self.panel_1, wx.ID_ANY) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.on_next, self.button_2) # end wxGlade
def __init__(self, *args, **kwds):#(self, parent, id, title): kwds["style"] = wx.CAPTION | wx.CLOSE_BOX | wx.STAY_ON_TOP | wx.FRAME_FLOAT_ON_PARENT | wx.TAB_TRAVERSAL wx.Dialog.__init__(self, *args, **kwds) #wx.Dialog.__init__(self, parent, id, title, size=(260, 200)) self.ShowMe() self.Centre()
def __init__(self, *args, **kwds): # begin wxGlade: Institution.__init__ kwds["style"] = wx.CAPTION | wx.CLOSE_BOX | wx.STAY_ON_TOP | wx.FRAME_FLOAT_ON_PARENT | wx.TAB_TRAVERSAL wx.Dialog.__init__(self, *args, **kwds) self.label_1 = wx.StaticText(self, -1, "Institution Settings") self.label_2 = wx.StaticText(self, -1, "School Name") self.text_ctrl_5 = wx.TextCtrl(self, -1, "",style=wx.TE_READONLY)#wx.StaticText(self, -1, "") self.label_4 = wx.StaticText(self, -1, "School Code") self.text_ctrl_6 = wx.TextCtrl(self, -1, "",style=wx.TE_READONLY)#wx.StaticText(self, -1, "") self.label_6 = wx.StaticText(self, -1, "E-Mail") self.text_ctrl_1 = wx.TextCtrl(self, -1, "", style=wx.TE_PROCESS_ENTER ) self.label_7 = wx.StaticText(self, -1, "Contact") self.text_ctrl_2 = wx.TextCtrl(self, -1, "", style=wx.TE_PROCESS_ENTER ) self.label_8 = wx.StaticText(self, -1, "DEO") self.text_ctrl_3 = wx.TextCtrl(self, -1, "", style=wx.TE_PROCESS_ENTER) self.button_1 = wx.Button(self, -1, "Cancel") self.button_2 = wx.Button(self, -1, "OK") self.DB=db_operations() self.__set_properties() self.__do_layout() self.OnLoad() self.Bind(wx.EVT_TEXT, self.OnText, self.text_ctrl_1) self.Bind(wx.EVT_TEXT, self.OnText, self.text_ctrl_2) self.Bind(wx.EVT_TEXT, self.Ontext, self.text_ctrl_3) self.Bind(wx.EVT_BUTTON, self.OnCancel, self.button_1) self.Bind(wx.EVT_BUTTON, self.OnOk, self.button_2) self.Bind(wx.EVT_CLOSE, self.OnClose) # end wxGlade
def __init__(self, *args, **kwds): # begin wxGlade: MyDialog.__init__ kwds["style"] = wx.CAPTION | wx.CLOSE_BOX | wx.STAY_ON_TOP wx.Dialog.__init__(self, *args, **kwds) self.text_ctrl_passwd = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_PASSWORD) self.button_cancel = wx.Button(self, wx.ID_ANY, _("Cancel")) self.button_ok = wx.Button(self, wx.ID_ANY, _("OK")) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_TEXT, self.on_passwod, self.text_ctrl_passwd) self.Bind(wx.EVT_BUTTON, self.on_button_cancel, self.button_cancel) self.Bind(wx.EVT_BUTTON, self.on_button_ok, self.button_ok) # end wxGlade
def __init__(self): """Constructor""" on_top = wx.DEFAULT_FRAME_STYLE | wx.STAY_ON_TOP wx.Frame.__init__(self, None, title="Stay on top", style=on_top) panel = wx.Panel(self) self.Show()