易截截图软件、单文件、免安装、纯绿色、仅160KB

Python TKinter Gui: Toplevel window

#from pp3e Chapter 9.3
#############################################################################
# popup three new window, with style
# destroy() kills one window, quit() kills all windows and app; top-level
# windows have title, icon, iconify/deiconify and protocol for wm events;
# there always is an app root window, whether by default or created as an
# explicit Tk() object; all top-level windows are containers, but never
# packed/gridded; Toplevel is like frame, but new window, and can have menu;
#############################################################################
    
from Tkinter import *
root = Tk()                                                     # explicit root
    
trees = [('The Larch!',          'light blue'),
         ('The Pine!',           'light green'),
         ('The Giant Redwood!', 'red')]
    
for (tree, color) in trees:
    win = Toplevel(root)                                        # new window
    win.title('Sing...')                                        # set border
    win.protocol('WM_


相关文档:

python查找中文字符

#filename Seek.py
import unicodedata
import sys
import os
class Seek():
    """
    功能:查找中文,并替换成指定字符或字符串
    使用方法:python脚本用法
    参数说明:
        -d& ......

Python Socket编程

1,编写Server.py
import socket
s=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
s.bind(('localhost',8081))
while True:
    data,addr=s.recvfrom(1024)
    print 'receive:',data,'from',addr
2,编写Client.py
import socket
s=socket.socket(socket.AF_INET,socket.SOC ......

话说Python(三)万恶的编码

万恶的编码
小菜对于老师上一节讲的不是很明白,因为没有一本书是将文件与web一起讲授的,他决定自己探究一下它们之间的不同:
首先,小菜在C盘建了一个文本文档 file.txt,输入四个字:我是小菜。
然后,小菜在shell中练习起来:
>>> file=open("c:\\file.txt","r")
>>> data=file.read()
>> ......

python的变参


python的变参
*args和**dargs是Python的两个可
变参数,两者有所不同的是*args是个tuple,**dargs是个dict。
*args
和**dargs并用时,*args必须放在**dargs的前面。
例如:
def func(a,b, *c):
    pass
函数func至少有两个参数变参数放在tuple  c中
def func(*c): 或者 def  func(**d ......

基本数据结构的python实现 队列

队列:
与堆栈类似,通过python的列表类型来实现,参考 help(list)
shoplist=['apple','mango','carrot','banana']
print 'I have',len(shoplist),'items to purchase'
print 'these items are:'
for item in shoplist:
print item,
shoplist.append('rice')
print 'my shopping list is now', shoplist
shoplist. ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号