ウィンドウや背景画像を表示するためにtkinterを得ることができます。誰もが一度に両方の画像を表示する方法を提案しています(オブジェクトを背景画像に表示したい)。以下:Tkinterキャンバスに画像が表示されない
from tkinter import *
from tkinter import ttk
root= Tk()
# Code to add widgets will go here...
root.title("MTGO Daily Decklists")
def test():
print("things")
# pick a .gif image file you have in the working directory
# or give full path
image1 = PhotoImage(file="backgroundimage.gif")
w = Canvas(root, width=800, height=700,)
background = PhotoImage(file = "backgroundimage.gif")
w.create_image(500, 500, image=image1)
w.pack()
format_mtg= StringVar()
format_entry= ttk.Entry(w, width=25, textvariable=format_mtg)
format_entry_window = w.create_window(10, 10, anchor='n', window=format_entry)
format_entry.pack()
date= StringVar()
date_entry=ttk.Entry(root, width=25, textvariable=date)
date_entry_window = w.create_window(10, 10, anchor='n', window=date_entry)
date_entry.pack()
ttk.Label(w, text="input format here").pack()
ttk.Button(w, text="fetch", command=test).pack()
ttk.Label(w, text="input date here").pack()
sortby= StringVar()
sortby_entry= ttk.Entry()
sortby_entry.pack()
ttk.Label(w, text="input how you want the decklists to be sorted").pack()
root.mainloop()
背景画像からキャンバス画像を作成しようとする試みはありません。 – TigerhawkT3
おっと、私は w.create_image(500、500、画像=バックグラウンド) に w.create_image(500、500、画像=画像1)を変更していますが、画像 'にそれを変更した場合、それはまだ同じ問題 – dovefromhell
を持っています=あなたは 'image1'のためのキャンバスイメージを作成するために行を追加しましたか、あるいはあなたは1つのイメージしか作成していませんか? – TigerhawkT3