#-*- coding: cp949 -*-
# 메모장
# 메모장
from Tkinter import *
import tkMessageBox
import os.path
filename = "data.txt"
import tkMessageBox
import os.path
filename = "data.txt"
def ClearText():
text.delete(1.0, END)
text.delete(1.0, END)
def SaveData():
textData = text.get(1.0, END).encode('cp949')
tempFileData = ""
if os.path.exists(filename):
fp = open(filename, 'r')
tempFileData = fp.read()
fp.close()
fp = open(filename, 'w')
fp.write(textData)
fp.write(tempFileData)
fp.close()
textData = text.get(1.0, END).encode('cp949')
tempFileData = ""
if os.path.exists(filename):
fp = open(filename, 'r')
tempFileData = fp.read()
fp.close()
fp = open(filename, 'w')
fp.write(textData)
fp.write(tempFileData)
fp.close()
def ShowInfo():
tkMessageBox.showinfo("Information","http://chobocho.com\nVersion 0.1")
tkMessageBox.showinfo("Information","http://chobocho.com\nVersion 0.1")
#----------------------------------------------------------
# main
if __name__ == "__main__":
root = Tk()
text = Text(root, width=50, height = 20)
text.pack()
text = Text(root, width=50, height = 20)
text.pack()
save_button = Button(root, text="Save", command = SaveData)
clear_button = Button(root, text="Clear", command = ClearText)
info_button = Button(root, text="Info", command = ShowInfo)
clear_button = Button(root, text="Clear", command = ClearText)
info_button = Button(root, text="Info", command = ShowInfo)
info_button.pack(side=RIGHT)
clear_button.pack(side=RIGHT)
save_button.pack(side=RIGHT)
clear_button.pack(side=RIGHT)
save_button.pack(side=RIGHT)
root.mainloop()
'Coding > Python 삽질기' 카테고리의 다른 글
간단한 메모장2 (0) | 2008.09.17 |
---|---|
Fractal Tree (0) | 2008.06.21 |
파일을 HEX 값으로 보여 주는 소스 (0) | 2008.05.19 |