|
原帖由 wanderxjtu 于 2008-10-22 14:41 发表 ) E8 X* f p( z- A V, i+ s
. g! s+ s/ v9 P1 a
, N- f% G. b8 g, d+ m" n0 \3 Z这个用了windows only的库ImageGrab, 还有windows的路径,我以为直接拿来就能在linux上用呢
3 |: D$ [; C. K% M. h. b# E囧 3 w2 W3 `! M2 Q, m! u1 v; j. N
ImageGrab.py中的说明:
5 o8 ], y+ ?1 u0 h8 ]& X' { 20 ##
) s% o. R1 c) A* ?/ K 21 # (New in 1.1.3) The <b>ImageGrab</b> module can be used to copy# R# r" {1 k7 K+ _# E" w6 v
22 # the contents of the screen to a PIL image memory.
Z" G. Z/ h" m1 ]0 h& L0 F 23 # <p>' L6 H; J( `5 |7 ?( Y$ X
24 # The current version works on Windows only.</p>
4 A `5 g; {$ n% ?6 Q 25 #+ l1 I+ S2 k0 l% a6 N% |" \
26 # @since 1.1.3
; l8 i: h: g' K 27 ##, b0 s' w$ C+ W% ?3 M
$ n- W1 E7 x! d1 E2 W4 }* P/ _去掉Import ImageGrab后的错误:4 w+ Z D! k* |+ Y, O$ d( [' J
Traceback (most recent call last):
5 v4 O3 j; j) D% X9 [ f0 L File "./pdbEditor.py", line 1555, in <module>. p/ R( \& s# {8 ^! U7 I1 G2 f" X
GUI()
4 q& ?. W* p& I7 H% F% [ File "./pdbEditor.py", line 1310, in GUI! n( B3 \& s1 {8 l& b2 Z
Application(None, -1, size=(780, 515))
1 B- X9 } Q) V& v File "./pdbEditor.py", line 862, in __init__+ |, x4 W' y: W5 S. L
self.createPageFont()
0 a% H' n, `9 o File "./pdbEditor.py", line 954, in createPageFont
' p# v# F9 s9 a( ]8 a self.initchoices()- _; \4 \. r b0 a k. J
File "./pdbEditor.py", line 1005, in initchoices
5 K" c3 Z1 x1 H* B$ ] os.chdir(os.path.join(os.environ['WINDIR'],'Fonts')); d: ?$ }/ z/ ]# N4 n8 U
File "/usr/lib/python2.5/UserDict.py", line 22, in __getitem__
9 ~- _/ N, j* E$ K raise KeyError(key)
- Y* d5 d# v( T, |1 U8 C* @KeyError: 'WINDIR'; Q( s5 X. I# b" V& I9 Y5 E
* h" D: W- H" I4 \ h+ n, C楼主能改下不?这个工作量应该不大吧,期待。 |
|