Dear All,

I am new in python programming, kindly help me out.

*Problem:  *Basically as user press the "Next image button" the image
should get refreshed by the next image from the specified path and so on.
The problem is on pressing the button the image is coming below of the
previous image not on top of it. Basically I want the images should slide
on pressing the next button. I am sharing my code for understanding. You
need few "bmp" files and set the path according to which path need to set
in the program.

====================================================
from Tkinter import *
from PIL import Image, ImageTk

root = Tk()

def Click():

    image = Image.open("C:/Users/Slide2.bmp")
    photo = ImageTk.PhotoImage(image)

    label = Label(root,image=photo)
    label.image = photo # keep a reference!
    label.pack()



image = Image.open("C:/Users/Slide1.bmp")
photo = ImageTk.PhotoImage(image)
label = Label(root,image=photo)

label.image = photo # keep a reference!
label.pack()


labelframe = LabelFrame(root)
labelframe.pack(fill="both", expand="yes")


left = Label(labelframe)

button=Button(labelframe, padx = 5, pady = 5, text="Next",command = Click)
button.pack(side = RIGHT)


R1 = Radiobutton(labelframe, text="Choice 1", value=1)
R1.pack(side = LEFT)

R2 = Radiobutton(labelframe, text="Choice 2",  value=2)
R2.pack(side = LEFT)


left.pack()
root.mainloop()

============================================

-- 
Thanks
Rajat Das
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
https://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to