python2.7练习 写一个简单的文本编辑器

本文档展示了如何使用Python2.7和wxWidgets库创建一个简单的文本编辑器。编辑器包含文件菜单,支持打开、保存、退出操作,并在主窗口中显示文本。
摘要由CSDN通过智能技术生成
# -*- coding: utf-8 -*-

import wx, os, sys
class MenuBarWindow(wx.Frame):
    def __init__(self, parent, title):
        
        # A "-1" in the size parameter instructs wxWidgets to use the default size.
        # In this case, we select 200px width and the default height.
        wx.Frame.__init__(self, parent, title=title, size=wx.DefaultSize)
        self.control = wx.TextCtrl(self, style=wx.TE_MULTILINE)
        # A StatusBar in the bottom of the window
        self.CreateStatusBar()
        
        # Setting up the menu.
        filemenu = wx.Menu()
        # wx.ID_ABOUT and wx.ID_EXIT are standard IDs provided by wxWidgets.
        menuAbout = filemenu.Append(wx.ID_ABOUT, "About", " Information about this program")
        menuOpen = filemenu.Append(wx.ID_OPEN, "Open", "Open a file to editor")
        menuExit = filemenu.Append(wx.ID_EXIT, "Exit", " Terminate
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值