我在网格上制作了一本Tkinter书,按钮按钮向左滚动,照片显示在多行的右列上,这样按钮就会显示出来。制作这本Tkinter书时。 我做了一个网格在Tkinter def工作如何?
left1 = Button(win, text=" Captian Scarlet ")# win, is root master
left1.configure(command=but1)# but1 is my first def
left1.grid(row=1, column=0)# all the buttons are on the left list
这显示一个按钮,就像一个按钮而不
然后我做了一个高清
def but1():
img = Image.open("captain_scarlett.gif")# loads the gif file
intro = ImageTk.PhotoImage(img)# loads image drivers I belevie
right1 = Label(win, image=intro)# I think Lable is used the same as html <span>
right1.grid(row=0, column=1, rowspan=13)# image formatting to display correctly with buttons
因为我有在缺乏教育的DEF时间,我只能让图像在def之外取代。所以在挫折中,我发布了 “这个代码在没有进入def的时候是有效的”。 当我安定下来,我需要知识,我无法在网上找到,所以我问了这个问题: 那么我如何得到这个代码工作在一个def?
我现在对它进行测试。 – 2013-02-22 12:06:08
right1.image = intro保存了我的整个软件我没有制作出任何一行代码的Tkinter书籍right1.image = intro – 2013-02-27 19:08:04