In this article, I will add an image to the form in python.
I will use the canvas method for this.
Figure 1
from tkinter import *
canvas_width = 200
canvas_height =200
root = Tk()
root.title("canvas image..bs")
canvas = Canvas(root,
width=canvas_width,
height=canvas_height)
canvas.pack()
img = PhotoImage(file="D:\\matrix.gif")
canvas.create_image(100,100, anchor='center', image=img)
root.mainloop()
Happy coding.
No comments:
Post a Comment