15 E! ~1 ]; w3 g8 ?0 S
2
3 R" f( v. S- J, f( f$ e/ k 3, s S- F2 c( m
4; H# s+ S9 h9 X( g; p
5" o( @+ u/ b* G+ o! u% |, _
6
" r |1 s- [( B" Q/ J' Y 7
0 r& K/ T& A) J3 \7 B 8
5 { {; w, }& u9 T 9
/ A: h6 J! w" b. c; B! S 109 n# E- G1 D/ \4 c
114 @* {) J1 t2 j3 i6 _
12& A/ |; I0 y( `. z2 l9 `6 Q
133 U' O9 A7 e* E
143 v4 {2 I7 U2 W7 m
157 \. d+ _: i( o: q4 f' i& u
16
* G* B l2 c4 z; w | from tkinter import *! j/ ]2 f' P) W W! `- @4 H% a# s
root = tk('simple editor')
% j: m( ?# n1 t. D+ m' M- m0 j# p& \/ F mi=stringvar()
# a9 g6 L# Z: A1 ~) z label(text='please input something you like~' ).pack()8 n. K' m* s2 g; S( v9 x$ f* U
te = text(height = 30,width =100): Q6 X+ F* d& {
te.pack()3 F# [6 M" L2 ]3 Z
label(text=' file name ').pack(side = left)3 {% E$ f B C3 T$ ~
entry(textvariable = mi).pack(side = left)
; `' |+ ^" f' {( r- q8 O0 S mi.set('*.txt')
& F# @+ ~6 p5 c& l def save():8 U# v! s s( ?' d% l4 ~
t = te.get('0.0','10.0')
5 H1 h% Y4 {, I1 o$ i/ m1 \ f = open(mi.get(),'w')
3 j: W: b; b, m n: Z f.write(t) @2 j* h. ?% T; X7 v0 o+ y
button(text = 'save' , command = save).pack(side = right)4 U/ ^; d( [/ n# D* z0 a
button(text = 'exit' , command = root.quit).pack(side = right)- a! i* i0 R2 {! t) J2 c
mainloop()
& ?: K9 W0 V) I: T8 F/ i' z
5 E& Z5 g! \ Q+ m1 Y+ x4 \: j |