#!/usr/bin/python #! coding: utf-8 ins_xml = './install.xml' import Tkinter import sys import subprocess message = {} message['english'] = 'The system detects the presence of the last\n \ installation to retain the configuration file, whether to use' message['chinese'] = '系统检测到存在上次安装保留的配置文件,是否使用它' def ok(): root.destroy() def cancel(): cmd='rm -rf ' + ins_xml subprocess.Popen(cmd,shell=True) root.destroy() def init(language): global root root = Tkinter.Tk() root.geometry("%sx%s+%d+%d" % (root.winfo_screenwidth()/2,\ root.winfo_screenheight()/2,\ root.winfo_screenwidth()/4, root.winfo_screenheight()/4)) txt = message[language] lab = Tkinter.Label(root,text=txt) lab.grid(row=1,column=1) btn1 = Tkinter.Button(root,text='OK',command=sys.modules[__name__].ok) btn2 = Tkinter.Button(root,text='Cancle',command=sys.modules[__name__].cancel) btn1.grid(row=2,column=0,padx=40,pady=100,ipadx=20) btn2.grid(row=2,column=2,padx=20,pady=100,ipadx=15) root.rowconfigure(1,weight=2) root.columnconfigure(1,weight=1) root.rowconfigure(2,weight=1) root.mainloop() init(sys.argv[1])