0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Tkinter】非モーダルなサブウィンドウの作成方法

Last updated at Posted at 2021-05-21

通常

これを元に非モーダルなサブウィンドウを作成します

import tkinter as tk
frame = tk.Tk()
tk.mainloop()

サブウィンドウの作成

frame2にトップレベルウィジェットを作成し適当にタイトルを設定

import tkinter as tk
frame = tk.Tk()
frame2 = tk.Toplevel().title("subwindow")
tk.mainloop()

おわり + 例

import tkinter as tk

frame = tk.Tk()
frame.title("main")
frame.geometry("150x150")
label1 = tk.Label(frame , text="main" , font=('',20))
label1.pack(anchor=tk.CENTER,expand=1)

frame2 = tk.Toplevel()
frame2.title("sub")
frame2.geometry("150x150")
label2 = tk.Label(frame2 , text="sub" , font=('',20))
label2.pack(anchor=tk.CENTER,expand=1)

frame3 = tk.Toplevel()
frame3.title("third")
frame3.geometry("150x150")
label3 = tk.Label(frame3 , text="third" , font=('',20))
label3.pack(anchor=tk.CENTER,expand=1)

tk.mainloop()
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?