Python wx.OK Examples
The following are 30
code examples of wx.OK().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
wx
, or try the search function
.
Example #1
Source File: backend_wx.py From Mastering-Elasticsearch-7.0 with MIT License | 7 votes |
def __init__(self, parent, help_entries): wx.Dialog.__init__(self, parent, title="Help", style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) sizer = wx.BoxSizer(wx.VERTICAL) grid_sizer = wx.FlexGridSizer(0, 3, 8, 6) # create and add the entries bold = self.GetFont().MakeBold() for r, row in enumerate(self.headers + help_entries): for (col, width) in zip(row, self.widths): label = wx.StaticText(self, label=col) if r == 0: label.SetFont(bold) label.Wrap(width) grid_sizer.Add(label, 0, 0, 0) # finalize layout, create button sizer.Add(grid_sizer, 0, wx.ALL, 6) OK = wx.Button(self, wx.ID_OK) sizer.Add(OK, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 8) self.SetSizer(sizer) sizer.Fit(self) self.Layout() self.Bind(wx.EVT_CLOSE, self.OnClose) OK.Bind(wx.EVT_BUTTON, self.OnClose)
Example #2
Source File: misc.py From trelby with GNU General Public License v2.0 | 7 votes |
def __init__(self, parent, text, title): wx.Dialog.__init__(self, parent, -1, title, style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) vsizer = wx.BoxSizer(wx.VERTICAL) tc = wx.TextCtrl(self, -1, size = wx.Size(400, 200), style = wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_LINEWRAP) tc.SetValue(text) vsizer.Add(tc, 1, wx.EXPAND); vsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) okBtn = gutil.createStockButton(self, "OK") vsizer.Add(okBtn, 0, wx.ALIGN_CENTER) util.finishWindow(self, vsizer) wx.EVT_BUTTON(self, okBtn.GetId(), self.OnOK) okBtn.SetFocus()
Example #3
Source File: backend_wx.py From GraphicDesignPatternByPython with MIT License | 6 votes |
def __init__(self, parent, help_entries): wx.Dialog.__init__(self, parent, title="Help", style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) sizer = wx.BoxSizer(wx.VERTICAL) grid_sizer = wx.FlexGridSizer(0, 3, 8, 6) # create and add the entries bold = self.GetFont().MakeBold() for r, row in enumerate(self.headers + help_entries): for (col, width) in zip(row, self.widths): label = wx.StaticText(self, label=col) if r == 0: label.SetFont(bold) label.Wrap(width) grid_sizer.Add(label, 0, 0, 0) # finalize layout, create button sizer.Add(grid_sizer, 0, wx.ALL, 6) OK = wx.Button(self, wx.ID_OK) sizer.Add(OK, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 8) self.SetSizer(sizer) sizer.Fit(self) self.Layout() self.Bind(wx.EVT_CLOSE, self.OnClose) OK.Bind(wx.EVT_BUTTON, self.OnClose)
Example #4
Source File: gui.py From RF-Monitor with GNU General Public License v2.0 | 6 votes |
def open(self, filename): try: freq, gain, cal, dynP, monitors = load_recordings(filename) except ValueError: msg = '\'' + os.path.split(filename)[1] + '\' is corrupt.' wx.MessageBox(msg, 'Error', wx.OK | wx.ICON_ERROR) return self._filename = filename self.__set_title() self._toolbar.set_freq(freq) self._toolbar.set_gain(gain) self._toolbar.set_cal(cal) self._toolbar.set_dynamic_percentile(dynP) self.__clear_monitors() self.__add_monitors(monitors) self.__enable_controls(True) self.__set_timeline() self.__set_spectrum() self._isSaved = True self._warnedPush = False
Example #5
Source File: gutil.py From trelby with GNU General Public License v2.0 | 6 votes |
def showTempPDF(pdfData, cfgGl, mainFrame): try: try: util.removeTempFiles(misc.tmpPrefix) fd, filename = tempfile.mkstemp(prefix = misc.tmpPrefix, suffix = ".pdf") try: os.write(fd, pdfData) finally: os.close(fd) util.showPDF(filename, cfgGl, mainFrame) except IOError, (errno, strerror): raise MiscError("IOError: %s" % strerror) except TrelbyError, e: wx.MessageBox("Error writing temporary PDF file: %s" % e, "Error", wx.OK, mainFrame)
Example #6
Source File: util.py From trelby with GNU General Public License v2.0 | 6 votes |
def writeToFile(filename, data, frame): try: f = open(misc.toPath(filename), "wb") try: f.write(data) finally: f.close() return True except IOError, (errno, strerror): wx.MessageBox("Error writing file '%s': %s" % ( filename, strerror), "Error", wx.OK, frame) return False
Example #7
Source File: gutil.py From trelby with GNU General Public License v2.0 | 6 votes |
def createStockButton(parent, label): # wxMSW does not really have them: it does not have any icons and it # inconsistently adds the shortcut key to some buttons, but not to # all, so it's better not to use them at all on Windows. if misc.isUnix: ids = { "OK" : wx.ID_OK, "Cancel" : wx.ID_CANCEL, "Apply" : wx.ID_APPLY, "Add" : wx.ID_ADD, "Delete" : wx.ID_DELETE, "Preview" : wx.ID_PREVIEW } return wx.Button(parent, ids[label]) else: return wx.Button(parent, -1, label) # wxWidgets has a bug in 2.6 on wxGTK2 where double clicking on a button # does not send two wx.EVT_BUTTON events, only one. since the wxWidgets # maintainers do not seem interested in fixing this # (http://sourceforge.net/tracker/index.php?func=detail&aid=1449838&group_id=9863&atid=109863), # we work around it ourselves by binding the left mouse button double # click event to the same callback function on the buggy platforms.
Example #8
Source File: misc.py From trelby with GNU General Public License v2.0 | 6 votes |
def getClientData(cbil): tmp = {} for i in range(len(cbil)): cbi = cbil[i] if cbi.selected: tmp[cbi.cdata] = None return tmp # shows one or two (one if cbil2 = None) checklistbox widgets with # contents from cbil1 and possibly cbil2, which are lists of # CheckBoxItems. btns[12] are bools for whether or not to include helper # buttons. if OK is pressed, the incoming lists' items' selection status # will be modified.
Example #9
Source File: cfgdlg.py From trelby with GNU General Public License v2.0 | 6 votes |
def OnChangeFont(self, event): fname = self.fontsLb.GetClientData(self.fontsLb.GetSelection()) nfont = getattr(self.cfg, fname) fd = wx.FontData() nfi = wx.NativeFontInfo() nfi.FromString(nfont) font = wx.FontFromNativeInfo(nfi) fd.SetInitialFont(font) dlg = wx.FontDialog(self, fd) if dlg.ShowModal() == wx.ID_OK: font = dlg.GetFontData().GetChosenFont() if util.isFixedWidth(font): setattr(self.cfg, fname, font.GetNativeFontInfo().ToString()) self.cfg.fontYdelta = util.getFontHeight(font) self.cfg2gui() self.updateFontLb() else: wx.MessageBox("The selected font is not fixed width and" " can not be used.", "Error", wx.OK, cfgFrame) dlg.Destroy()
Example #10
Source File: cfgdlg.py From trelby with GNU General Public License v2.0 | 6 votes |
def OnAdd(self, event): dlg = misc.KeyDlg(cfgFrame, self.cmd.name) key = None if dlg.ShowModal() == wx.ID_OK: key = dlg.key dlg.Destroy() if key: kint = key.toInt() if kint in self.cmd.keys: wx.MessageBox("The key is already bound to this command.", "Error", wx.OK, cfgFrame) return if key.isValidInputChar(): wx.MessageBox("You can't bind input characters to commands.", "Error", wx.OK, cfgFrame) return self.cmd.keys.append(kint) self.cfg2gui()
Example #11
Source File: trelby.py From trelby with GNU General Public License v2.0 | 6 votes |
def updateKbdCommands(self): cfgGl.addShiftKeys() if cfgGl.getConflictingKeys() != None: wx.MessageBox("You have at least one key bound to more than one\n" "command. The program will not work correctly until\n" "you fix this.", "Warning", wx.OK, self) self.kbdCommands = {} for cmd in cfgGl.commands: if not (cmd.isFixed and cmd.isMenu): for key in cmd.keys: self.kbdCommands[key] = cmd # open script, in the current tab if it's untouched, or in a new one # otherwise
Example #12
Source File: trelby.py From trelby with GNU General Public License v2.0 | 6 votes |
def checkFonts(self): names = ["Normal", "Bold", "Italic", "Bold-Italic"] failed = [] for i, fi in enumerate(cfgGui.fonts): if not util.isFixedWidth(fi.font): failed.append(names[i]) if failed: wx.MessageBox( "The fonts listed below are not fixed width and\n" "will cause the program not to function correctly.\n" "Please change the fonts at File/Settings/Change.\n\n" + "\n".join(failed), "Error", wx.OK, self) # If we get focus, pass it on to ctrl.
Example #13
Source File: url_handler.py From NVDARemote with GNU General Public License v2.0 | 6 votes |
def windowProc(self, hwnd, msg, wParam, lParam): if msg != WM_COPYDATA: return hwnd = wParam struct_pointer = lParam message_data = ctypes.cast(struct_pointer, PCOPYDATASTRUCT) url = ctypes.wstring_at(message_data.contents.lpData) log.info("Received url: %s" % url) try: con_info = connection_info.ConnectionInfo.from_url(url) except connection_info.URLParsingError: wx.CallLater(50, gui.messageBox, parent=gui.mainFrame, caption=_("Invalid URL"), # Translators: Message shown when an invalid URL has been provided. message=_("Unable to parse url \"%s\"")%url, style=wx.OK | wx.ICON_ERROR) log.exception("unable to parse nvdaremote:// url %s" % url) raise log.info("Connection info: %r" % con_info) if callable(self.callback): wx.CallLater(50, self.callback, con_info)
Example #14
Source File: gui.py From report-ng with GNU General Public License v2.0 | 6 votes |
def Save_Report_As(self, e): openFileDialog = wx.FileDialog(self, 'Save Report As', self.save_into_directory, '', 'XML files (*.xml)|*.xml|All files (*.*)|*.*', wx.FD_SAVE | wx.wx.FD_OVERWRITE_PROMPT) if openFileDialog.ShowModal() == wx.ID_CANCEL: return filename = openFileDialog.GetPath() if filename == self.report._template_filename: wx.MessageBox('For safety reasons, template overwriting with generated report is not allowed!', 'Error', wx.OK | wx.ICON_ERROR) return self.status('Generating and saving the report...') self.report.scan = self.scan self._clean_template() #self.report.xml_apply_meta() self.report.xml_apply_meta(vulnparam_highlighting=self.menu_view_v.IsChecked(), truncation=self.menu_view_i.IsChecked(), pPr_annotation=self.menu_view_p.IsChecked()) self.report.save_report_xml(filename) #self._clean_template() # merge kb before generate self.ctrl_tc_k.SetValue('') self.menu_tools_merge_kb_into_content.Enable(False) self.status('Report saved')
Example #15
Source File: backend_wx.py From Computable with MIT License | 6 votes |
def __init__(self, bitmap, renderer): GraphicsContextBase.__init__(self) #assert self.Ok(), "wxMemoryDC not OK to use" DEBUG_MSG("__init__()", 1, self) dc, gfx_ctx = self._cache.get(bitmap, (None, None)) if dc is None: dc = wx.MemoryDC() dc.SelectObject(bitmap) gfx_ctx = wx.GraphicsContext.Create(dc) gfx_ctx._lastcliprect = None self._cache[bitmap] = dc, gfx_ctx self.bitmap = bitmap self.dc = dc self.gfx_ctx = gfx_ctx self._pen = wx.Pen('BLACK', 1, wx.SOLID) gfx_ctx.SetPen(self._pen) self._style = wx.SOLID self.renderer = renderer
Example #16
Source File: backend_wx.py From Mastering-Elasticsearch-7.0 with MIT License | 6 votes |
def __init__(self, bitmap, renderer): GraphicsContextBase.__init__(self) # assert self.Ok(), "wxMemoryDC not OK to use" DEBUG_MSG("__init__()", 1, self) DEBUG_MSG("__init__() 2: %s" % bitmap, 1, self) dc, gfx_ctx = self._cache.get(bitmap, (None, None)) if dc is None: dc = wx.MemoryDC() dc.SelectObject(bitmap) gfx_ctx = wx.GraphicsContext.Create(dc) gfx_ctx._lastcliprect = None self._cache[bitmap] = dc, gfx_ctx self.bitmap = bitmap self.dc = dc self.gfx_ctx = gfx_ctx self._pen = wx.Pen('BLACK', 1, wx.SOLID) gfx_ctx.SetPen(self._pen) self.renderer = renderer
Example #17
Source File: backend_wx.py From matplotlib-4-abaqus with MIT License | 6 votes |
def __init__(self, bitmap, renderer): GraphicsContextBase.__init__(self) #assert self.Ok(), "wxMemoryDC not OK to use" DEBUG_MSG("__init__()", 1, self) dc, gfx_ctx = self._cache.get(bitmap, (None, None)) if dc is None: dc = wx.MemoryDC() dc.SelectObject(bitmap) gfx_ctx = wx.GraphicsContext.Create(dc) gfx_ctx._lastcliprect = None self._cache[bitmap] = dc, gfx_ctx self.bitmap = bitmap self.dc = dc self.gfx_ctx = gfx_ctx self._pen = wx.Pen('BLACK', 1, wx.SOLID) gfx_ctx.SetPen(self._pen) self._style = wx.SOLID self.renderer = renderer
Example #18
Source File: __init__.py From NVDARemote with GNU General Public License v2.0 | 6 votes |
def verify_connect(self, con_info): if self.is_connected() or self.connecting: gui.messageBox(_("NVDA Remote is already connected. Disconnect before opening a new connection."), _("NVDA Remote Already Connected"), wx.OK|wx.ICON_WARNING) return self.connecting = True server_addr = con_info.get_address() key = con_info.key if con_info.mode == 'master': message = _("Do you wish to control the machine on server {server} with key {key}?").format(server=server_addr, key=key) elif con_info.mode == 'slave': message = _("Do you wish to allow this machine to be controlled on server {server} with key {key}?").format(server=server_addr, key=key) if gui.messageBox(message, _("NVDA Remote Connection Request"), wx.YES|wx.NO|wx.NO_DEFAULT|wx.ICON_WARNING) != wx.YES: self.connecting = False return if con_info.mode == 'master': self.connect_as_master((con_info.hostname, con_info.port), key=key) elif con_info.mode == 'slave': self.connect_as_slave((con_info.hostname, con_info.port), key=key) self.connecting = False
Example #19
Source File: backend_wx.py From neural-network-animation with MIT License | 6 votes |
def __init__(self, bitmap, renderer): GraphicsContextBase.__init__(self) #assert self.Ok(), "wxMemoryDC not OK to use" DEBUG_MSG("__init__()", 1, self) dc, gfx_ctx = self._cache.get(bitmap, (None, None)) if dc is None: dc = wx.MemoryDC() dc.SelectObject(bitmap) gfx_ctx = wx.GraphicsContext.Create(dc) gfx_ctx._lastcliprect = None self._cache[bitmap] = dc, gfx_ctx self.bitmap = bitmap self.dc = dc self.gfx_ctx = gfx_ctx self._pen = wx.Pen('BLACK', 1, wx.SOLID) gfx_ctx.SetPen(self._pen) self._style = wx.SOLID self.renderer = renderer
Example #20
Source File: pyResManDialog.py From pyResMan with GNU General Public License v2.0 | 6 votes |
def __handleDebuggerResponse(self, args): rsp = args[0] commandInfo = args[1] commandIndex = commandInfo[0] commandName = commandInfo[1] commandValue = commandInfo[2] if rsp[0]: self._listctrlDebuggerScriptCommand.SetCellTextColour(commandIndex, COMMAND_LIST_COL_RESPONSE, '#000000') self._listctrlDebuggerScriptCommand.SetCellValue(commandIndex, COMMAND_LIST_COL_RESPONSE, Util.vs2s(rsp[1], '')) self._listctrlDebuggerScriptCommand.SetCellValue(commandIndex, COMMAND_LIST_COL_DESCRIPTION, 'OK') self._listctrlDebuggerScriptCommand.SetCellTextColour(commandIndex, COMMAND_LIST_COL_DESCRIPTION, '#008B00') else: errorcode = ord(rsp[1]) errorString = self.getDebuggerErrorString(errorcode) self._Log('Command %d-%s-%s failed, error: %s (0x%02X). \n' % (commandIndex, commandName, Util.vs2s(commandValue, ''), errorString, errorcode), wx.LOG_Error) self._listctrlDebuggerScriptCommand.SetCellValue(commandIndex, COMMAND_LIST_COL_DESCRIPTION, 'Error: %s (0x%02X)' % (errorString, errorcode)) self._listctrlDebuggerScriptCommand.SetCellTextColour(commandIndex, COMMAND_LIST_COL_DESCRIPTION, '#FF0000') self._listctrlDebuggerScriptCommand.SetCellValue(commandIndex, COMMAND_LIST_COL_RESPONSE, '')
Example #21
Source File: gui.py From RF-Monitor with GNU General Public License v2.0 | 6 votes |
def __on_rec(self, recording): timestamp = time.time() for monitor in self._monitors: if not recording: monitor.set_level(None, timestamp, None) monitor.set_recording(recording, timestamp) if recording: self.__on_start() else: while self._push.hasFailed(): resp = wx.MessageBox('Web push has failed, retry?', 'Warning', wx.OK | wx.CANCEL | wx.ICON_WARNING) if resp == wx.OK: busy = wx.BusyInfo('Pushing...', self) self._push.send_failed(self._settings.get_push_uri()) del busy else: self._push.clear_failed() self._warnedPush = False self.__set_timeline()
Example #22
Source File: backend_wx.py From GraphicDesignPatternByPython with MIT License | 6 votes |
def __init__(self, bitmap, renderer): GraphicsContextBase.__init__(self) # assert self.Ok(), "wxMemoryDC not OK to use" DEBUG_MSG("__init__()", 1, self) DEBUG_MSG("__init__() 2: %s" % bitmap, 1, self) dc, gfx_ctx = self._cache.get(bitmap, (None, None)) if dc is None: dc = wx.MemoryDC() dc.SelectObject(bitmap) gfx_ctx = wx.GraphicsContext.Create(dc) gfx_ctx._lastcliprect = None self._cache[bitmap] = dc, gfx_ctx self.bitmap = bitmap self.dc = dc self.gfx_ctx = gfx_ctx self._pen = wx.Pen('BLACK', 1, wx.SOLID) gfx_ctx.SetPen(self._pen) self._style = wx.SOLID self.renderer = renderer
Example #23
Source File: message.py From openplotter with GNU General Public License v2.0 | 5 votes |
def __init__(self, parent): conf = Conf() Language(conf) wx.Frame.__init__(self, parent) dlg = wx.MessageDialog(self, text, _('Message'), wx.OK | wx.ICON_WARNING) dlg.ShowModal() sys.exit()
Example #24
Source File: main.py From NXP-MCUBootFlasher with Apache License 2.0 | 5 votes |
def callbackShowRevisionHistory( self, event ): msgText = ((uilang.kMsgLanguageContentDict['revisionHistory_v1_0_0'][self.languageIndex]) + (uilang.kMsgLanguageContentDict['revisionHistory_v2_0_0'][self.languageIndex]) + (uilang.kMsgLanguageContentDict['revisionHistory_v3_0_0'][self.languageIndex])) wx.MessageBox(msgText, uilang.kMsgLanguageContentDict['revisionHistory_title'][self.languageIndex], wx.OK | wx.ICON_INFORMATION)
Example #25
Source File: add_trigger.py From openplotter with GNU General Public License v2.0 | 5 votes |
def ShowMessage(self, w_msg): wx.MessageBox(w_msg, 'Info', wx.OK | wx.ICON_INFORMATION)
Example #26
Source File: add_MCP.py From openplotter with GNU General Public License v2.0 | 5 votes |
def on_convert(self, e): convert = 0 if self.convert.GetValue(): convert = 1 if self.conf.has_option('SPI', 'value_' + str(self.edit[2])): data = self.conf.get('SPI', 'value_' + str(self.edit[2])) try: temp_list = eval(data) except: temp_list = [] min = 1023 max = 0 for ii in temp_list: if ii[0] > max: max = ii[0] if ii[0] < min: min = ii[0] if min > 0: wx.MessageBox(_('minimum raw value in setting table > 0'), 'info', wx.OK | wx.ICON_INFORMATION) convert = 0 if max < 1023: wx.MessageBox(_('maximum raw value in setting table < 1023'), 'info', wx.OK | wx.ICON_INFORMATION) convert = 0 else: wx.MessageBox(_('no option value ').decode('utf8') + str(self.edit[2]) + _(' in openplotter.conf').decode('utf8'), 'info', wx.OK | wx.ICON_INFORMATION) convert = 0 self.convert.SetValue(convert)
Example #27
Source File: add_kplex.py From openplotter with GNU General Public License v2.0 | 5 votes |
def ShowMessage(self, w_msg): wx.MessageBox(w_msg, 'Info', wx.OK | wx.ICON_INFORMATION)
Example #28
Source File: add_deviation_setting.py From openplotter with GNU General Public License v2.0 | 5 votes |
def ShowMessage(self, w_msg): wx.MessageBox(w_msg, 'Info', wx.OK | wx.ICON_WARNING)
Example #29
Source File: calculate.py From openplotter with GNU General Public License v2.0 | 5 votes |
def ShowMessage(self, w_msg): wx.MessageBox(w_msg, 'Info', wx.OK | wx.ICON_INFORMATION)
Example #30
Source File: edit_i2c.py From openplotter with GNU General Public License v2.0 | 5 votes |
def ShowMessage(self, w_msg): wx.MessageBox(w_msg, 'Info', wx.OK | wx.ICON_INFORMATION)