我创建了一个包含按钮,图像,ext的UI,并设法使滚动条出现,但是它不会在画布上上下滚动。我已经尝试了多种方法来解决这个问题,尽管我在互联网上发现了这些方法,但是都没有奏效。我没有收到任何错误消息。下面是我的代码,我只保留了少量标签和按钮,滚动条的主要代码位于顶部。谢谢您的任何帮助。
self.root3=tk.Toplevel()
frame_3=tk.Frame(self.root3,width=2000,height=1080)
frame_3.pack(expand=True, fill=BOTH)
canvas=Canvas(frame_3,bg='black',width=2000,height=1080,scrollregion=(0,0,4000,2060))
hbar=Scrollbar(frame_3,orient=HORIZONTAL)
hbar.pack(side=BOTTOM,fill=X)
hbar.config(command=canvas.xview)
vbar=Scrollbar(frame_3,orient=VERTICAL)
vbar.pack(side=RIGHT,fill=Y)
vbar.config(command=canvas.yview)
canvas.config(width=2000,height=1080)
canvas.config(xscrollcommand=hbar.set, yscrollcommand=vbar.set)
canvas.pack(side=LEFT,expand=True,fill=BOTH)
HButton = tk.Button(canvas,bg="orange",text="History",command = self.History_View)
HButton.place(x=1000,y=20)
Title_label = tk.Label(canvas,bg="black", fg = "orange",text ="MOVIES R US")
Title_label.place(x=500,y=0)
Title_label.config(font=("Ariel","20"))
action_label=tk.Label(canvas,bg="black",fg="orange",text="ACTION")
action_label.place(x=50,y=60)
action_label.config(font=("Ariel","20"))
AEGimg=tk.PhotoImage(file="AEG.gif")
AEGlabel = tk.Label(self.root3, image=AEGimg,bd=0)#bd = 0 removes border
AEGlabel.image= AEGimg
AEGlabel=tk.Button(self.root3,image=AEGimg, bd=0,bg="black", command=self.AEG_film)
AEGlabel.place(x=50,y=100, anchor= NW)