Slide 33
Slide 33 text
Microsoft Windows [Version 10.0.18362.1256]
(c) 2019 Microsoft Corporation. All rights reserved.
C:\Users\user>python
Python 3.11.4 (tags/v3.11.4:d2340ef, Jun 7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> copyright
Copyright (c) 2001-2023 Python Software Foundation.
All Rights Reserved.
Copyright (c) 2000 BeOpen.com.
All Rights Reserved.
Copyright (c) 1995-2001 Corporation for National Research Initiatives.
All Rights Reserved.
Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam.
All Rights Reserved.
>>> import tkinter as tk
>>> form = tk.Tk()
>>> form.geometry("600x400")
''
>>> form.title("画像表示")
''
>>> btn1 = tk.Button(form,text="表示")
>>> btn2 = tk.Button(form,text="消す")
>>> btn1.pack(side=tk.LEFT)
>>> btn2.pack(side=tk.LEFT)
>>> canvas = tk.Canvas(form,bg="#808080",width="530",height="400")
>>> canvas.pack(side=tk.LEFT)
>>> img = tk.PhotoImage(file="pyoko_computer.png",width="400",height="400")
>>> canvas.create_image(0,0,image=img,anchor=tk.NW)
1
>>>
色が変わっているところが不要な部分になります。
細かいですが、全て消してください。