-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ronish
authored and
Ronish
committed
Apr 27, 2021
1 parent
cbb1c8e
commit 8739e3d
Showing
7 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from tkinter import * | ||
from PIL import ImageTk, Image | ||
from tkinter import filedialog | ||
|
||
root = Tk() | ||
root.title("Dialog Box") | ||
root.iconbitmap("image.ico") | ||
|
||
def open(): | ||
global my_image | ||
root.filename = filedialog.askopenfilename(initialdir="/Downloads", title="Select a file", | ||
filetypes=(("Png Files ", "*.png"), ("All Files", "*.*"))) | ||
|
||
# sets the location of the selected image in the label | ||
my_label = Label(root, text=root.filename).pack() | ||
#image also gets displayed | ||
my_image = ImageTk.PhotoImage(Image.open(root.filename)) | ||
my_image_label = Label(image=my_image).pack() | ||
|
||
my_btn = Button(root, text ="Open File", command =open).pack() | ||
|
||
mainloop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from tkinter import * | ||
|
||
root = Tk() | ||
|
||
root.title("Images Insertion") | ||
|
||
root.iconbitmap("image.ico") | ||
Frame = LabelFrame(root, text ="MyFrame", padx=5, pady=5) | ||
Frame.pack(padx=10,pady=10) | ||
|
||
root.mainloop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from tkinter import * | ||
from PIL import ImageTk, Image | ||
|
||
root = Tk() | ||
|
||
#title | ||
root.ttle("Image Insertion") | ||
|
||
#icon images | ||
# png icons does not support sometimes | ||
root.iconbitmap("image.ico") | ||
|
||
my_image = ImageTk.PhotoImage(Image.open("photo.png")) | ||
my_label = Label( image = my_image) | ||
my_label.pack() | ||
|
||
|
||
button_quit= Button(root, text="Exit", command=root.quit, width=20) | ||
button_quit.pack() | ||
|
||
|
||
|
||
root.mainloop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
|
||
Frame = LabelFrame(root, text ="MyFrame", padx=5, pady=5) | ||
Frame.pack(padx=10,pady=10) | ||
root.mainloop() |