View difference between Paste ID: 6GWZaspQ and xu4ctAdT
SHOW: | | - or go back to the newest paste.
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が返ります", default="", title=" "):
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())