|
原帖由 wanderxjtu 于 2008-10-22 14:41 发表 
( l2 e; S! Z6 S
# r4 u& }3 t) h% `0 w& f* @* }+ E; o, }6 Z6 x- T7 Q; z7 Q; {
这个用了windows only的库ImageGrab, 还有windows的路径,我以为直接拿来就能在linux上用呢" w2 N& L+ @, n/ H: d7 g7 {
囧 9 i; Y5 E* y$ s& k; ^; w% z
ImageGrab.py中的说明:2 r- z7 }9 v: O/ ?2 Y1 a$ I1 b+ v: J
20 ##3 W% l8 o' s; R: N: f
21 # (New in 1.1.3) The <b>ImageGrab</b> module can be used to copy) v0 t: u# f8 |9 F* ^# g# ~
22 # the contents of the screen to a PIL image memory.
+ _: X2 E) m. J5 z3 Z: a7 [& q 23 # <p>
: f$ O& ^) b$ o$ R5 `, ^$ q 24 # The current version works on Windows only.</p>
9 g% J7 {4 T/ o& |6 `0 |: I- F 25 #8 E+ O# E) M. P k& |5 W
26 # @since 1.1.34 J5 p8 ~! Q) ]4 `+ L
27 ##
8 J5 n ?9 B5 H4 C) b# ?
/ g0 T9 v9 m* u( @- K& R去掉Import ImageGrab后的错误:! h" b& ?3 N! |! e$ I: W% s
Traceback (most recent call last):
# A: {, Z2 |/ d File "./pdbEditor.py", line 1555, in <module>" }* a' h7 N2 j+ [
GUI()
" P& y$ Y% Z8 R, ^ y& X File "./pdbEditor.py", line 1310, in GUI, Z! q' x! ]* `$ D9 }! K
Application(None, -1, size=(780, 515))
: v& `5 X/ m$ M) ?, F9 A( q8 R2 E File "./pdbEditor.py", line 862, in __init__" [% m* V; X- |2 M4 d
self.createPageFont()
; [4 N0 X+ \ | File "./pdbEditor.py", line 954, in createPageFont
, O" @/ k! i; b. G self.initchoices()
# v7 X3 J2 k# c. z File "./pdbEditor.py", line 1005, in initchoices: H1 i. U# V# J) ^
os.chdir(os.path.join(os.environ['WINDIR'],'Fonts'))
5 q3 W& h7 [- Z File "/usr/lib/python2.5/UserDict.py", line 22, in __getitem__
# K5 _% C: o! E9 u8 z) n4 g$ e. n raise KeyError(key)1 i8 S" p' l3 {0 h2 l) x( P
KeyError: 'WINDIR'
% A8 x6 l2 j: a5 z) y! Z
7 K5 Y# t3 `4 h6 D% ?% J& Y2 m楼主能改下不?这个工作量应该不大吧,期待。 |
|