
flw 回复于:2007-04-07 10:28:42
不错!支持!建议版主加精华。
eookoo 回复于:2007-04-09 07:35:57
完成品是由 2 樓的 code 改成過來...
如果見到 : # --- new: --- or # --- Changed: ---
就是新加入的東西 or 改變過的東西
import wx
# -------- new: we need os module to handle path, dir stuffs-----------
import os
# ------- new: make our own id numbers --------------
ID_OPEN = 100
ID_SAVE = 101
ID_EXIT = 102
ID_ABOUT = 200
class SimpleEditor(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title, size = (700, 600))
# ---------------------create a text area ----------------------
self.text = wx.TextCtrl(self, 1, style=wx.TE_MULTILINE)
# ---------------------create a status bar ---------------------
self.CreateStatusBar()
# ---------------------create a menu bar -----------------------
menuBar = wx.MenuBar()
# ---------------------create a menu ---------------------------
# making two new menus
menuFile = wx.Menu()
menuHelp = wx.Menu()
# ------------- Changed: use our own id instead wx.ID_ANY ------------------
#menuFile.Append(wx.ID_ANY, '&Open', 'open a file')
#menuFile.Append(wx.ID_ANY, '&Save', 'save the file')
menuFile.Append(ID_OPEN, '&Open', 'open a file')
menuFile.Append(ID_SAVE, '&Save', 'save the file')
# ----------------------------------------------------------------------
# adding a separator to separate the menu list
menuFile.AppendSeparator()
# ------------- Changed: use our own id instead wx.ID_ANY ------------------
#menuFile.Append(wx.ID_ANY, 'E&xit', 'terminate the program')
#menuHelp.Append(wx.ID_ANY, 'A&bout', 'info about this program')
menuFile.Append(ID_EXIT, 'E&xit', 'terminate the program')
menuHelp.Append(ID_ABOUT, 'A&bout', 'info about this program')
# -------------------------------------------------------------------------
| 论坛热门帖子: | [lch203] 写得蛮好的linux学习笔记(10-21) [黑马制造] 学习java的30个目标(10-19) [笑傲股林] 做测试半年了,有点迷茫,应该再学些什么提高自己的测试水平和测试能力呢?(10-19) [udp8589] 大家用google的来吱一声? 用百度的~~也来报道下?(10-18) [沂偌掳兆] 本人总结的一些认为C++比较经典的书籍,希望对大家有用(10-18) |
| TAG标签: | 完成 例子 self wx.ID_ANY parent id title 回复 style |
注册
个人空间
