您的位置:首页 > 编程语言 > Python开发

python_GUI应用程序代码

2017-06-22 00:00 162 查看
# coding=utf-8

'''

Created on 2017年3月2日

@author : chenkai

GUI 是 Graphical User Interface 的简称,即图形用户接口,通常人机交互图形化用户界面设计经常读做“goo-ee”,

准确来说 GUI 就是屏幕产品的视觉体验和互动操作部分。

GUI 是一种结合计算机科学、美学、心理学、行为学,及各商业领域需求分析的人机系统工程,

强调人—机—环境三者作为一个系统进行总体设计。

'''

import wx

#加载函数

def load(event):

fileLoad=open(filename.GetValue())

contents.SetValue(fileLoad.read())

fileLoad.close()

#保存函数

def save(event):

fileSave=open(filename.GetValue(),'w')

fileSave.write(contents.GetValue())

fileSave.close()

def guanbi(event):

win.Close()

app=wx.App()

win=wx.Frame(None,title='Simple Editor',size=(500,400))#设置窗口标签

#bkg=wx.Panel(win)#面板

#父窗口中添加按钮

loadButton=wx.Button(win,label='open',pos=(225,5),size=(80,25))#加载按钮,以及标签名#设置位置和尺寸

loadButton.Bind(wx.EVT_BUTTON,load)#绑定函数

saveButton=wx.Button(win,label='save',pos=(310,5),size=(80,25))#保存按钮,以及标签名#设置位置和尺寸

saveButton.Bind(wx.EVT_BUTTON,save)

filename=wx.TextCtrl(win,pos=(5,5),size=(210,25))#设置文本框

contents=wx.TextCtrl(win,pos=(5,35),size=(455,310),style=wx.TE_MULTILINE|wx.HSCROLL)

closeButton=wx.Button(win,label='close',pos=(395,5),size=(80,25))#加载按钮,以及标签名#设置位置和尺寸

closeButton.Bind(wx.EVT_BUTTON,guanbi)#绑定函数

win.Show()

app.MainLoop()
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息