1; G/ F/ }5 i/ i+ e. N H3 J( }
2( B( a2 o0 i& ]
36 O- f$ b% _2 {
4" d' R% L" v& d" f- i7 N
5( e4 n; Y( B# f) S+ E4 S
66 }7 }; P& S9 L" g8 v
77 p4 K$ z& b4 v6 e
8
* u$ i/ K- s8 H0 `) p( [8 {( q 9) B6 K" x3 U9 F9 [- W
107 R+ q" J% b! p0 ^. a; J: H
11
' a( x- s0 X, y; g 12/ t5 l0 i' a% \+ l6 j
13/ S* F8 X" d! ?2 F
144 g0 Y" @; M5 q- V
15
3 r) V7 l# z% N3 A+ C' G 16+ I( d G S- p5 k/ j
| from tkinter import *
* s1 c4 I* W7 g$ x6 r5 S( r, D root = tk('simple editor')
0 g+ n$ L% f; _7 a5 S mi=stringvar()7 n' M: A- m; B/ C& m
label(text='please input something you like~' ).pack()2 r0 x# U* \" B# v8 E, _, A8 f
te = text(height = 30,width =100)
( \8 {7 a8 |3 b' k2 y% _ te.pack()1 p; ^9 J) S- Q
label(text=' file name ').pack(side = left) w+ L- _: v$ _0 g
entry(textvariable = mi).pack(side = left)
9 G: X/ _# C% V) j' e mi.set('*.txt')
0 `$ L) Y6 M, ~/ w! w def save():' ]) R* G1 k* q" q9 }
t = te.get('0.0','10.0')0 y' @4 \' T6 l5 E+ q: v" C
f = open(mi.get(),'w')1 \/ J/ R) Z" q$ ]/ ?) F
f.write(t)6 ]/ w* K; U% h+ N
button(text = 'save' , command = save).pack(side = right)
7 Z; w" c, \% s) | button(text = 'exit' , command = root.quit).pack(side = right)
( g4 t! {* f! g2 { mainloop()
$ {! p, p. M, h; m" C& {
, t; ]; l6 J& l/ |6 i, t' e |