| Conditions | 3 |
| Total Lines | 38 |
| Code Lines | 33 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import tkinter as tk |
||
| 18 | def __init__(self, message, caption, cancel, title, text): |
||
| 19 | self.txt = "" |
||
| 20 | self.sub_name_win = tk.Toplevel(message) |
||
| 21 | self.txt_name = ttk.Entry(self.sub_name_win, width=40) |
||
| 22 | self.txt_name.grid( |
||
| 23 | row=0, |
||
| 24 | column=0, |
||
| 25 | columnspan=2, |
||
| 26 | padx=5, |
||
| 27 | pady=5, |
||
| 28 | sticky=tk.W+tk.E, |
||
| 29 | ipady=3 |
||
| 30 | ) |
||
| 31 | button = ttk.Button( |
||
| 32 | self.sub_name_win, |
||
| 33 | text=caption, |
||
| 34 | width=str(caption), |
||
| 35 | padding=(10, 5), |
||
| 36 | command=self.sub_name_ok |
||
| 37 | ) |
||
| 38 | button.grid(row=1, column=0) |
||
| 39 | if cancel: |
||
| 40 | button2 = ttk.Button( |
||
| 41 | self.sub_name_win, |
||
| 42 | text=u'キャンセル', |
||
| 43 | width=str(u'キャンセル'), |
||
| 44 | padding=(10, 5), |
||
| 45 | command=self.sub_name_win.destroy |
||
| 46 | ) |
||
| 47 | |||
| 48 | button2.grid(row=1, column=1) |
||
| 49 | self.txt_name.focus() |
||
| 50 | if text is not False: |
||
| 51 | self.txt_name.insert(tk.END, text) |
||
| 52 | self.txt_name.select_range(0, 'end') |
||
| 53 | |||
| 54 | self.sub_name_win.title(title) |
||
| 55 | self.txt_name.focus() |
||
| 56 | |||
| 73 |