diff --git a/Calculator.py b/Calculator.py index a2a313b..6162779 100644 --- a/Calculator.py +++ b/Calculator.py @@ -6,6 +6,7 @@ # Defining the title of the project* root.title("Simple Calculator") root.resizable(0,0,) +root.iconbitmap("image.ico") e = Entry(root, width=35 , font=("Times New roman", 18) , bg="skyblue" , borderwidth=20) e.grid(row=0, column=0, columnspan=10, padx=10, pady=10) diff --git a/dialog_box.py b/dialog_box.py new file mode 100644 index 0000000..a257fad --- /dev/null +++ b/dialog_box.py @@ -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() \ No newline at end of file diff --git a/imag.py b/imag.py new file mode 100644 index 0000000..84c6445 --- /dev/null +++ b/imag.py @@ -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() \ No newline at end of file diff --git a/image.ico b/image.ico new file mode 100644 index 0000000..e7f8a75 Binary files /dev/null and b/image.ico differ diff --git a/photo.png b/photo.png new file mode 100644 index 0000000..769a46a Binary files /dev/null and b/photo.png differ diff --git a/test.py b/test.py index e69de29..320b489 100644 --- a/test.py +++ b/test.py @@ -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() \ No newline at end of file diff --git a/venv/frame.py b/venv/frame.py new file mode 100644 index 0000000..b424849 --- /dev/null +++ b/venv/frame.py @@ -0,0 +1,5 @@ + + +Frame = LabelFrame(root, text ="MyFrame", padx=5, pady=5) +Frame.pack(padx=10,pady=10) +root.mainloop() \ No newline at end of file