Python基于Tkinter实现的记事本实例
2015-06-17 00:00
1226 查看
本文实例讲述了Python基于Tkinter实现的记事本。分享给大家供大家参考。具体如下:
from Tkinter import * root = Tk('Simple Editor') mi=StringVar() Label(text='Please input something you like~' ).pack() te = Text(height = 30,width =100) te.pack() Label(text=' File name ').pack(side = LEFT) Entry(textvariable = mi).pack(side = LEFT) mi.set('*.txt') def save(): t = te.get('0.0','10.0') f = open(mi.get(),'w') f.write(t) Button(text = 'Save' , command = save).pack(side = RIGHT) Button(text = 'Exit' , command = root.quit).pack(side = RIGHT) mainloop()
希望本文所述对大家的Python程序设计有所帮助。
相关文章推荐
- Python实现的彩票机选器实例
- 在Python中使用glob模块查找文件路径的方法
- Python变量
- python 爬虫
- Python常用常见知识汇总
- Python产生随机数
- python中if __name__ == '__main__': 的解析
- Python HAIL CAESAR (凯撒密码) 3
- 学习Python4(hashlib)
- python中根据list中字符串元素的某一位(几位数字)对list排序
- ipython与python的区别
- win7搭建Python开发环境(下篇--安装pip和ipython解释器)
- Scrapy迁移到生产服务器(aliyun)
- IPython,让Python显得友好十倍的外套——windows XP/Win7安装详解
- Mac配置Python开发环境并实现简单的字符串和整数拼接
- Python读写文件
- BlenderPython (一)介绍及安装
- Python-django安装
- ZH奶酪:Python 中缀表达式转换后缀表达式
- [Python基础]008.异常