这是我的代码-我试图创建_text并将其放置在图像上,但当运行代码时,我只能看到它甚至出现,如果我在位置0,0创建它,位置400,263的其他文本不显示(因为它放置在图像下)
window = Tk()
window.title("Flash Card")
window.config(pady=50, padx=50, background=BACKGROUND_COLOR)
canvas = Canvas(width=800, height=526)
french_background = PhotoImage (file ="images/card_front.png")
canvas.create_image(400, 263, image=french_background)
canvas.create_text(0, 0, text="French", fill= "black" , font=("Ariel", 40, "italic"))
canvas.create_text(400,263, text=random_french, fill="black", font=("Ariel",60,"bold"))
canvas.config(bg=BACKGROUND_COLOR, highlightthickness=0)
canvas.grid(row=0, column=0, columnspan=2)
1条答案
按热度按时间jvlzgdj91#
在
canvas.grid
之后使用canvas.create_text