本文整理汇总了Python中wx.ID_OK属性的典型用法代码示例。如果您正苦于以下问题:Python wx.ID_OK属性的具体用法?Python wx.ID_OK怎么用?Python wx.ID_OK使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.ID_OK属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_OK [as 别名]
def __init__(self, parent):
wx.Dialog.__init__(self, parent)
self.SetBackgroundColour('#ffffff')
self.ok_button = wx.Button(self, wx.ID_OK, label='Ok')
self.datepicker = wx.DatePickerCtrl(self, style=wx.DP_DROPDOWN)
vertical_container = wx.BoxSizer(wx.VERTICAL)
vertical_container.AddSpacer(10)
vertical_container.Add(wx_util.h1(self, label='Select a Date'), 0, wx.LEFT | wx.RIGHT, 15)
vertical_container.AddSpacer(10)
vertical_container.Add(self.datepicker, 0, wx.EXPAND | wx.LEFT | wx.RIGHT, 15)
vertical_container.AddSpacer(10)
button_sizer = wx.BoxSizer(wx.HORIZONTAL)
button_sizer.AddStretchSpacer(1)
button_sizer.Add(self.ok_button, 0)
vertical_container.Add(button_sizer, 0, wx.LEFT | wx.RIGHT, 15)
vertical_container.AddSpacer(20)
self.SetSizerAndFit(vertical_container)
self.Bind(wx.EVT_BUTTON, self.OnOkButton, self.ok_button)
示例2: OnOK
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_OK [as 别名]
def OnOK(self, event):
# master list
ml = []
# sub-list
sl = []
for i in range(self.locationsLb.GetCount()):
scene = self.locationsLb.GetClientData(i)
if scene:
sl.append(scene)
elif sl:
ml.append(sl)
sl = []
self.sp.locations.locations = ml
self.sp.locations.refresh(self.sp.getSceneNames())
self.EndModal(wx.ID_OK)
示例3: createStockButton
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_OK [as 别名]
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.
示例4: OnChangeFont
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_OK [as 别名]
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()
示例5: OnAdd
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_OK [as 别名]
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()
示例6: genSceneReport
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_OK [as 别名]
def genSceneReport(mainFrame, sp):
report = scenereport.SceneReport(sp)
dlg = misc.CheckBoxDlg(mainFrame, "Report type", report.inf,
"Information to include:", False)
ok = False
if dlg.ShowModal() == wx.ID_OK:
ok = True
dlg.Destroy()
if not ok:
return
data = report.generate()
gutil.showTempPDF(data, sp.cfgGl, mainFrame)
示例7: genLocationReport
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_OK [as 别名]
def genLocationReport(mainFrame, sp):
report = locationreport.LocationReport(scenereport.SceneReport(sp))
dlg = misc.CheckBoxDlg(mainFrame, "Report type", report.inf,
"Information to include:", False)
ok = False
if dlg.ShowModal() == wx.ID_OK:
ok = True
dlg.Destroy()
if not ok:
return
data = report.generate()
gutil.showTempPDF(data, sp.cfgGl, mainFrame)
示例8: OnGotoPage
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_OK [as 别名]
def OnGotoPage(self):
self.sp.paginate()
self.clearAutoComp()
pages = self.sp.getPageNumbers()
def validateFunc(s):
if s in pages:
return ""
else:
return "Invalid page number."
dlg = misc.TextInputDlg(mainFrame, "Enter page number (%s - %s):" %\
(pages[0], pages[-1]), "Goto page", validateFunc)
if dlg.ShowModal() == wx.ID_OK:
page = int(dlg.input)
self.sp.line = self.sp.page2lines(page)[0]
self.sp.column = 0
# we need to refresh the screen in all cases because pagination
# might have changed
self.makeLineVisible(self.sp.line)
self.updateScreen()
示例9: OnSaveScriptAs
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_OK [as 别名]
def OnSaveScriptAs(self):
if self.fileName:
dDir = os.path.dirname(self.fileName)
dFile = os.path.basename(self.fileName)
else:
dDir = misc.scriptDir
dFile = u""
dlg = wx.FileDialog(mainFrame, "Filename to save as",
defaultDir = dDir,
defaultFile = dFile,
wildcard = "Trelby files (*.trelby)|*.trelby|All files|*",
style = wx.SAVE | wx.OVERWRITE_PROMPT)
if dlg.ShowModal() == wx.ID_OK:
self.saveFile(dlg.GetPath())
dlg.Destroy()
示例10: OnImportScript
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_OK [as 别名]
def OnImportScript(self, event = None):
dlg = wx.FileDialog(self, "File to import",
misc.scriptDir,
wildcard = "Importable files (*.txt;*.fdx;*.celtx;*.astx;*.fountain;*.fadein)|" +
"*.fdx;*.txt;*.celtx;*.astx;*.fountain;*.fadein|" +
"Formatted text files (*.txt)|*.txt|" +
"Final Draft XML(*.fdx)|*.fdx|" +
"Celtx files (*.celtx)|*.celtx|" +
"Adobe Story XML files (*.astx)|*.astx|" +
"Fountain files (*.fountain)|*.fountain|" +
"Fadein files (*.fadein)|*.fadein|" +
"All files|*",
style = wx.OPEN)
if dlg.ShowModal() == wx.ID_OK:
misc.scriptDir = dlg.GetDirectory()
if not self.tabCtrl.getPage(self.findPage(self.panel))\
.ctrl.isUntouched():
self.panel = self.createNewPanel()
self.panel.ctrl.importFile(dlg.GetPath())
self.panel.ctrl.updateScreen()
dlg.Destroy()
示例11: OnLoadSettings
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_OK [as 别名]
def OnLoadSettings(self, event = None):
dlg = wx.FileDialog(self, "File to open",
defaultDir = os.path.dirname(gd.confFilename),
defaultFile = os.path.basename(gd.confFilename),
wildcard = "Setting files (*.conf)|*.conf|All files|*",
style = wx.OPEN)
if dlg.ShowModal() == wx.ID_OK:
s = util.loadFile(dlg.GetPath(), self)
if s:
c = config.ConfigGlobal()
c.load(s)
gd.confFilename = dlg.GetPath()
self.panel.ctrl.applyGlobalCfg(c, False)
dlg.Destroy()
示例12: OnLoadScriptSettings
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_OK [as 别名]
def OnLoadScriptSettings(self, event = None):
dlg = wx.FileDialog(self, "File to open",
defaultDir = gd.scriptSettingsPath,
wildcard = "Script setting files (*.sconf)|*.sconf|All files|*",
style = wx.OPEN)
if dlg.ShowModal() == wx.ID_OK:
s = util.loadFile(dlg.GetPath(), self)
if s:
cfg = config.Config()
cfg.load(s)
self.panel.ctrl.applyCfg(cfg)
gd.scriptSettingsPath = os.path.dirname(dlg.GetPath())
dlg.Destroy()
示例13: OnLoadMesh
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_OK [as 别名]
def OnLoadMesh(self, evt):
dlg = wx.FileDialog(self, "Choose a file", ".", "", "OFF files (*.off)|*.off|TOFF files (*.toff)|*.toff|OBJ files (*.obj)|*.obj", wx.FD_OPEN)
if dlg.ShowModal() == wx.ID_OK:
filename = dlg.GetFilename()
dirname = dlg.GetDirectory()
filepath = os.path.join(dirname, filename)
print dirname
self.glcanvas.mesh = PolyMesh()
print "Loading mesh %s..."%filename
self.glcanvas.mesh.loadFile(filepath)
self.glcanvas.meshCentroid = self.glcanvas.mesh.getCentroid()
self.glcanvas.meshPrincipalAxes = self.glcanvas.mesh.getPrincipalAxes()
print "Finished loading mesh"
print self.glcanvas.mesh
self.glcanvas.initMeshBBox()
self.glcanvas.clearAllSelections()
self.glcanvas.Refresh()
dlg.Destroy()
return
示例14: OnLoadMesh
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_OK [as 别名]
def OnLoadMesh(self, evt):
dlg = wx.FileDialog(self, "Choose a file", ".", "", "OFF files (*.off)|*.off|TOFF files (*.toff)|*.toff|OBJ files (*.obj)|*.obj", wx.OPEN)
if dlg.ShowModal() == wx.ID_OK:
filename = dlg.GetFilename()
dirname = dlg.GetDirectory()
filepath = os.path.join(dirname, filename)
print dirname
self.glcanvas.mesh = PolyMesh()
print "Loading mesh %s..."%filename
self.glcanvas.mesh.loadFile(filepath)
self.glcanvas.meshCentroid = self.glcanvas.mesh.getCentroid()
self.glcanvas.meshPrincipalAxes = self.glcanvas.mesh.getPrincipalAxes()
print "Finished loading mesh"
print self.glcanvas.mesh
self.glcanvas.initMeshBBox()
self.glcanvas.Refresh()
dlg.Destroy()
return
示例15: of
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_OK [as 别名]
def of(self, event): # wxGlade: MainFrame.<event_handler>
filename = "" # Use filename as a flag
dlg = wx.DirDialog(self, message="Choose a folder")
if dlg.ShowModal() == wx.ID_OK:
dirname = dlg.GetPath()
dlg.Destroy()
self.texts.append("")
if dirname:
for(root, dirs, files) in os.walk(dirname):
for f in files:
with open(root + "/" + f, "rb") as fh:
fi = fh.read()[512:]
l_off = len(fi) % 512
self.texts[0] += fi + "\x00"*(512-l_off)
#self.texts.append(fh.read())