1
7 ? v3 i$ E9 o 2$ L7 ^4 q% L! y+ S: b
3# n4 V' P" M, `$ r6 o' @( R
4" {* Q1 I C9 F2 l0 B- r \! r! ?
5
! z) H* C! f. h# d1 o 6# H/ W K$ {: a
7
- ~3 _5 z2 N4 d8 X2 Y; m. Z 8
+ p7 q* \& H+ i+ F- m 9# W! {/ u/ W$ R" E; |5 W
10- y& A: U( h7 Q9 w
11
# q- x: T! D3 k6 c 12# Q L6 g0 S$ f( V
13
\3 f7 I7 ^, E: a1 n& E0 F 14; r9 H4 A; L& H3 |9 |# L& D3 R
157 O% V+ z; l# y' Z
16
4 I. w. ?0 O' J+ a `6 T | from tkinter import *- i. g1 n, f1 P2 \( G
root = tk('simple editor')
0 g0 u2 G1 G6 ~/ C& f, P mi=stringvar()
" G. G& G1 C( S: D$ Q: k' l! P label(text='please input something you like~' ).pack()- Y1 K/ d" I9 g& N
te = text(height = 30,width =100) |* r4 u! F& f; v6 [) u6 x0 t
te.pack()1 T/ Z0 M% K: {( h
label(text=' file name ').pack(side = left)# I2 j" c' _1 ~" @4 U9 T( v
entry(textvariable = mi).pack(side = left)
4 E% k5 W) P y, v+ m5 n mi.set('*.txt')+ O5 b& n9 U/ @ y2 p3 [. }' l5 V/ b
def save():. P' E% `" f7 }! W4 _ \1 G
t = te.get('0.0','10.0')( L" m& x' N( r; O
f = open(mi.get(),'w')" R9 I' \( z1 ~. c( Y, O1 k& c6 _
f.write(t)! w. P5 q: j7 J* T& Z
button(text = 'save' , command = save).pack(side = right)" W1 a- I' Y$ b n+ g
button(text = 'exit' , command = root.quit).pack(side = right)2 \! M; \! Y- Y
mainloop()7 s8 j* u6 Y; P( j; k
# L/ D6 h% ] h" g( G |