Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2014
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # -*- coding: utf-8 -*-
  2. import tkinter as tk
  3. import tkinter.simpledialog as sd
  4. import tkinter.messagebox as mb
  5. class main_window(tk.Frame):
  6.     def askstr(self, message="文字を入力してください", default="", title=" "):
  7.         return sd.askstring(title, message, initialvalue=default)
  8.     def askokcancel(self, message="「はい」でTrue 「キャンセル」でFalseが返ります",  title=" "):
  9.         return mb.askokcancel(title,message)
  10.  
  11. def msgbox(message="「はい」でTrue 「キャンセル」でFalseが返ります",title=" "):
  12.     root = tk.Tk()
  13.     root.wait_visibility()
  14.     root.withdraw()
  15.     mw = main_window(root)
  16.     return mw.askokcancel(message,title)
  17. def inputbox(message="文字を入力してください", default="", title=" "):
  18.     root = tk.Tk()
  19.     root.wait_visibility()
  20.     root.withdraw()
  21.     mw = main_window(root)
  22.     return mw.askstr(message, default, title)
  23.  
  24. print(msgbox())
  25. print(inputbox())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement