#-*-coding:cp936-*-
Import Sys,image,random,os,glob,time
From PYQT4 import Qtgui
From PYQT4 import Qtcore
def a (path):
For I in Glob.glob (path):
List1=[]
T=image.open (i)
Time.sleep (1)
#t1 =imageenhance.contrast (t)
#t1. Enhance (1.2). Show (' 25% more Conrast ')
print ' Picture storage directory is:%s '% (i), ' Picture format:%s, picture size:%s, Picture mode:%s '% (T.format,t.size,t.mode)
T.resize ((128, 128))
T.transpose (Image.flip_left_right)
#t. Transpose (IMAGE.ROTATE_90)
#t. Transpose (image.rotate_180)
#t. Transpose (image.rotate_270). Show ()
T.rotate (Random.randint (0,270)). Show (Time.sleep (1.2))
#导入之后随机从其中找一张, and then from the A-coordinate 0,0 to the B-coordinate (100,100) (it would have been a complex effect, because the
#到鼠标键盘事件 (not learned), and now change from a-coordinate 0,0 to B-coordinate (100,100) at random,
#并图片旋转到中间之后向右边去, then the next one)
def Image1 (t= ' JPEG '):
size=2000,2000
For i in Sys.argv[1:]:
Out=os.path.splitext (i) [0]+ ' PILQT '
If I!=out:
Try
Im=image.open (i)
IM.PILQT (size)
Im.save (out,t)
Except IOError:
print ' Cannot create pilqt: ', I
Class Tooltip (Qtgui.qwidget):
def __init__ (self, parent = None):
Qtgui.qwidget.__init__ (self, parent)
Self.setgeometry (300, 300, 250, 150)
Self.setwindowtitle (' Tooltip ')
Self.settooltip (Time.ctime ())
QtGui.QToolTip.setFont (Qtgui.qfont (' Oldenglish ', 10))
App = Qtgui.qapplication (SYS.ARGV)
tooltip = tooltip ()
Tooltip.show ()
Sys.exit (App.exec_ ())
PYTHONQT Practice N1