1
- _: p* a* G' x& H 2
; |6 J; H4 k0 S 3) P/ y+ z8 B7 m- \) P; x ^
4/ Y d0 e* p# a l$ z J! _
5( V& e1 u5 o4 k; C% \% S2 `
6$ k! U5 a' b- T2 f
7
6 j! V! k8 A! L' g 87 ^! u" p' o T! m0 ?0 k
9, F# ^. e- ~9 \5 D, F1 U
100 D, `/ R& K1 |- n0 \* g( M$ j
116 S b' `: i7 h( y g
12
' {: e6 c$ y' m- b5 L7 i+ B2 K ` 134 J( d- p7 }9 h6 x6 S8 C- F
143 u, Z* W9 Y3 ]8 k
15: K# j& b9 d8 M5 `
16 g/ k+ ?: j; f7 Z+ ~, O0 o8 R
| from tkinter import *
+ C3 g- L/ A" ]% c2 W root = tk('simple editor')
% e% E. j F+ {8 C( }) C mi=stringvar()9 H0 M. p, O# ^) g5 J
label(text='please input something you like~' ).pack()- |1 [& R6 h% {
te = text(height = 30,width =100)
, e% c( G* D/ r! K) S te.pack()% J. o9 D2 Q( c3 h8 e A9 B
label(text=' file name ').pack(side = left)
. O# s- N5 x; z# d entry(textvariable = mi).pack(side = left)
2 e" }/ J1 @# m% T* g; ^ mi.set('*.txt')8 P' ^: b1 t2 N$ Q5 _
def save():, \4 T* l* W: m. A
t = te.get('0.0','10.0'): l5 c* u* b2 Q6 V
f = open(mi.get(),'w')
. C B$ M1 |- P2 W' F b f.write(t)
; q& B7 @/ P/ x' N button(text = 'save' , command = save).pack(side = right)7 _3 J1 b/ W9 h7 k; A
button(text = 'exit' , command = root.quit).pack(side = right)
4 w% ~( ?4 x1 B7 P1 S$ J) J mainloop()) D' F) W8 e7 G6 {+ L/ I
; ?2 l h$ c- V9 l4 K8 r |