我们从Python开源项目中,提取了以下7个代码示例,用于说明如何使用wx.ID_NO。
def writePhonebookEntry(self, pos, name='', number=''): if self.abortedRead: dlg = wxskinMessageDialog(self, "Did not finish reading your entire SIM card phonebook.\nAs a result, this may overwrite any exisiting phonebook contacts that have not been read yet!\n\nDo you wish to continue anyway?", 'Overwrite warning', wx.YES_NO | wx.ICON_WARNING) ret = dlg.ShowModal() dlg.Destroy() if ret == wx.ID_NO: return wx.ID_NO else: self.abortedRead = 0 if not name: data = "FF" * self.recordLength else: GSMnumber = StringToGSMPhoneNumber(number) data = "%s%s%sFFFF" % ( padString(hexlify(ASCIIToGSM3_38(name)), self.nameLength << 1, "F"), IntToHex(len(GSMnumber) / 2), padString(GSMnumber, 22, 'F')) pdu = self.updateRecordPDU % (IntToHex(pos), IntToHex(self.recordLength), data) self.SIM.sendAPDUmatchSW(pdu, SW_OK) return wx.ID_YES
def yes_no(info, title="ImagePy Yes-No ?!"): dlg = wx.MessageDialog(curapp, info, title, wx.YES_NO | wx.CANCEL) rst = dlg.ShowModal() dlg.Destroy() dic = {wx.ID_YES:'yes', wx.ID_NO:'no', wx.ID_CANCEL:'cancel'} return dic[rst]
def on_hlink(self, event): # wxGlade: student_profie.<event_handler> new_acd_win=add_academic_year(self) new_acd_win.ShowModal() new_year=new_acd_win.NEW_YEAR if not new_year: new_acd_win.Destroy() return 0 new_acd_win.Destroy() years=self.DB.Get_Years() if years.count(int(new_year)): msg= "Acdemic year "+str(new_year)+"-"+str(int(new_year)+1)+"already exists" dlg = wx.MessageDialog(self,msg, 'Error Adding',wx.OK | wx.ICON_ERROR) dlg.ShowModal() dlg.Destroy() return years.sort() msg="Do you want to add new academic year "+new_year+"-"+str(int(new_year)+1) dlg = wx.MessageDialog(self, msg,"Add Year?", wx.YES_NO | wx.ICON_QUESTION) result = dlg.ShowModal()# == wx.ID_YES if result==wx.ID_NO: dlg.Destroy() return 0 dlg.Destroy() self.DB.Add_Div(new_year,'8','A') self.DB.Add_Div(new_year,'9','A') self.DB.Add_Div(new_year,'10','A') self.load_year() event.Skip()
def db_delete(self): msg="The student "+self.text_ctrl_name.Value+", along with all data, will be deleted\nAre you sure you want to continue?" dlg = wx.MessageDialog(self, msg,"Warning", wx.YES_NO | wx.ICON_QUESTION) result = dlg.ShowModal()# == wx.ID_YES if result==wx.ID_NO: return 0 dlg.Destroy() try: self.DB.Remove_Student_Full(self.combo_box_adno.GetStringSelection()) msg="Successfully Removed Student" icon=wx.ICON_INFORMATION except: msg="Failed to Remove the Student" icon=wx.ICON_ERROR dlg = wx.MessageDialog(self, msg, '',wx.OK | icon) dlg.ShowModal() dlg.Destroy() self.load_admission_no() self.clear_student_details() self.button_delete.Disable()
def LongTask(self): return_msg = None return_code = None reboot = False # Checking if System is connected through VPN if check_vpn and vpn_connected(arch=arch): dlg_msg = _(u"WPKG-GP Client detected a active VPN Connection using Cisco Anyconnect.\n" u"This could result in slow upgrade progress and updates for the AnyConnect\n" u"Software will be blocked.\n" u"Continue?") dlg = wx.MessageDialog(self, dlg_msg, app_name, wx.YES_NO | wx.YES_DEFAULT | wx.ICON_INFORMATION) if dlg.ShowModal() == wx.ID_NO: # Canceled by user because of active VPN Connection return_msg = 'WPKG process start canceled by user.' # Make translate able? return 400, return_msg, None # LONG TASK is the PipeConnection to the WPKG-GP Windows Service self.running = True msg = 'ExecuteNoReboot' try: pipeHandle = CreateFile("\\\\.\\pipe\\WPKG", GENERIC_READ|GENERIC_WRITE, 0, None, OPEN_EXISTING, 0, None) except pywintypes.error, (n, f, e): # print "Error when generating pipe handle: %s" % e # Can't connect to pipe error, probably service not running return_msg = u"Error: WPKG-GP Service not running" return 208, return_msg, None SetNamedPipeHandleState(pipeHandle, PIPE_READMODE_MESSAGE, None, None) WriteFile(pipeHandle, msg) while 1: try: (hr, readmsg) = ReadFile(pipeHandle, 512) out = readmsg[4:].decode('utf-8') #Strip 3 digit status code, decode characters status_code = int(readmsg[:3]) if status_code < 102: # default status code for pipe updates percentage = getPercentage(out) wx.CallAfter(self.update_box.SetValue, out) wx.CallAfter(self.gauge.SetValue, percentage) elif status_code > 300: # reboot necessary reboot = True elif status_code > 200: # possible error return_code = status_code return_msg = out except win32api.error as exc: if exc.winerror == winerror.ERROR_PIPE_BUSY: win32api.Sleep(5000) print 'Pipe Busy Error' continue break return return_code, return_msg, reboot