
Python
Alice_991
一个人的世界~~
展开
-
python--利用有道网址编写一个翻译句子的程序
import urllib.requestimport urllib.parseimport jsoncontent=input('请输入需要翻译的内容:')url='http://fanyi.youdao.com/translate?smartresult=dict&smartresult=rule&smartresult=ugc&sessionFrom=http://www.bai原创 2015-08-25 21:57:16 · 766 阅读 · 0 评论 -
Python--Tkinter之 Button()/Checkbutton()/Radiobutton()
RT:Button(): 点击打开链接Checkbutton():点击打开链接Radiobutton():点击打开链接 e.g.1from tkinter import *root=Tk()LANGS=[ ('python',1), ('shell',2), ('C++',3), ('数据结构',4)] v=In原创 2015-08-31 19:13:17 · 2193 阅读 · 0 评论 -
Python入门基础-easygui的使用_fileopenbox()的使用
提供一个文件夹浏览框,让用户选择需要打开的文本文档,打开并显示文件内容import easygui as gimport osmsg='文件【record.txt】的内容如下:'title='显示文件内容'file_path=g.fileopenbox(default='*.txt')with open(file_path) as f: #title=os.path.basen原创 2015-08-17 15:27:49 · 8840 阅读 · 0 评论 -
Python--Tkinter之Listbox()
Listbox() 用于显示一个选择列表http://bbs.fishc.com/forum.php?mod=viewthread&tid=59327&extra=page%3D2%26filter%3Dtypeid%26typeid%3D403安装垂直滚动条:1.设置改组件的yscrollbarcommand 选项为 Scrollbar 组件的set()方法;原创 2015-09-01 22:07:46 · 1250 阅读 · 0 评论 -
python之__init__()和__new__()的区分
#__new__()的使用>>> class CapStr(str): def __new__(cls,string): string=string.upper() return string>>> a=CapStr('I Love Fishc')>>> a'I LOVE FISHC'#__init__()的使用,对象实例化发生在__new__之后class C原创 2015-08-19 10:27:10 · 628 阅读 · 0 评论 -
Python之shell清屏
RT:点击打开链接解压附件 将这个文件放在Python X\Lib\idlelib目录下(X为你的python版本),然后在这个目录下找到config-extensions.def这个文件(idle扩展的配置文件),以记事本的方式打开它(为防止出错,你可以在打开它之前先copy一个备份)。额,打开后它看起来可能会密密麻麻的,如果可以,建议你最好用像sublime text或vim这样支持高亮格转载 2015-08-21 15:58:30 · 3061 阅读 · 0 评论 -
Python---tkinter之Text()
Text()介绍:点击打开链接e.g.1 创建一个窗口组件,插入到text中from tkinter import *root=Tk()text=Text(root,width=30,height=5)text.pack()text.insert(INSERT,'I Love\n')#INSERT表示在光标位置插入text.insert(END,'F原创 2015-09-07 16:21:42 · 13389 阅读 · 0 评论 -
Python---textbox之恢复撤销功能
rt#恢复和撤销操作from tkinter import *root=Tk()text=Text(root,width=30,height=5,undo=True)#默认undo是没有开启的text.pack()text.insert(INSERT,'I love FishC.com!')def show(): text.edit_undo() #撤销最近一次操原创 2015-09-08 11:00:29 · 1194 阅读 · 0 评论