How to Create bitmap image in label tkinter using for loop
Tkinter is one of the most common Interface of Python GUI(Graphical User Interface). Bitmap is used to display an image in the label. The Bitmap Image class provides a simple image class, for monochrome (two-color) images. This class can be used to display bitmap images in labels, buttons, canvases, and text widgets. bitmap is an array of binary data representing the values of pixels in an image. Bitmap is used to set the bitmap to the graphical object specified so that, the label can represent the graphics instead of text.To Create a bitmap image it can take the following values..1) error2) gray753) gray504) gray255) gray126) hourglass7) info8) questhead9) question10) warning
Example:
1) error
2) gray75
3) gray50
4) gray25
5) gray12
6) hourglass
7) info
8) questhead
9) question
10) warning
from tkinter import *
my_window = Tk()
my_window.title("Bitmap Image Using for loop ")
my_window.geometry("800x520+450+86")
my_window.config(bg="#8EE5EE")
list = ["gray75",
"gray50",
"gray25",
"gray1",
"hourglass",
"info",
"questhead",
"question",
"warning"]
for btmap in list:
lbl = Label(my_window,bitmap=btmap, bg="#FFD39B", width=50, height=40)
lbl.pack(pady=10)
my_window.mainloop()
from tkinter import *
my_window = Tk()
my_window.title("Bitmap Image Using for loop ")
my_window.geometry("800x520+450+86")
my_window.config(bg="#8EE5EE")
list = ["gray75",
"gray50",
"gray25",
"gray1",
"hourglass",
"info",
"questhead",
"question",
"warning"]
for btmap in list:
lbl = Label(my_window,bitmap=btmap, bg="#FFD39B", width=50, height=40)
lbl.pack(pady=10)
my_window.mainloop()
إرسال تعليق