diff --git a/Calculator.py b/Calculator.py index 6162779..6eba60c 100644 --- a/Calculator.py +++ b/Calculator.py @@ -6,7 +6,7 @@ # Defining the title of the project* root.title("Simple Calculator") root.resizable(0,0,) -root.iconbitmap("image.ico") +root.iconbitmap("calculator.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) @@ -75,20 +75,20 @@ def button_divide(): # Defining the buttons -button_1 = Button(root, text="1", font=("Times New Roman", 20,), padx=40, pady=20, command=lambda: button_click(1)) -button_2 = Button(root, text="2", font=("Times New Roman", 20,), padx=40, pady=20, command=lambda: button_click(2)) -button_3 = Button(root, text="3", font=("Times New Roman", 20,), padx=40, pady=20, command=lambda: button_click(3)) -button_4 = Button(root, text="4", font=("Times New Roman", 20,), padx=40, pady=20, command=lambda: button_click(4)) -button_5 = Button(root, text="5", font=("Times New Roman", 20,), padx=40, pady=20, command=lambda: button_click(5)) -button_6 = Button(root, text="6", font=("Times New Roman", 20,), padx=40, pady=20, command=lambda: button_click(6)) -button_7 = Button(root, text="7", font=("Times New Roman", 20,), padx=40, pady=20, command=lambda: button_click(7)) -button_8 = Button(root, text="8", font=("Times New Roman", 20,), padx=40, pady=20, command=lambda: button_click(8)) -button_9 = Button(root, text="9", font=("Times New Roman", 20,), padx=40, pady=20, command=lambda: button_click(9)) -button_0 = Button(root, text="0", font=("Times New Roman", 20,), padx=40, pady=20, command=lambda: button_click(0)) -button_add = Button(root, text="+", font=("Times New Roman", 20,), padx=39, pady=20, command=button_add) -button_subtract = Button(root, text="-", font=("Times New Roman", 20,), padx=40, pady=20, command=button_subract) -button_multiply = Button(root, text="×", font=("Times New Roman", 20,), padx=39, pady=20, command=button_multiply) -button_divide = Button(root, text="÷", font=("Times New Roman", 20,), padx=39, pady=20, command=button_divide) +button_1 = Button(root, text="1",bg="lightgrey", font=("Times New Roman", 20,), padx=40, pady=20, command=lambda: button_click(1)) +button_2 = Button(root, text="2", bg="lightgrey", font=("Times New Roman", 20,), padx=40, pady=20, command=lambda: button_click(2)) +button_3 = Button(root, text="3", bg="lightgrey", font=("Times New Roman", 20,), padx=40, pady=20, command=lambda: button_click(3)) +button_4 = Button(root, text="4", bg="lightgrey", font=("Times New Roman", 20,), padx=40, pady=20, command=lambda: button_click(4)) +button_5 = Button(root, text="5", bg="lightgrey", font=("Times New Roman", 20,), padx=40, pady=20, command=lambda: button_click(5)) +button_6 = Button(root, text="6", bg="lightgrey", font=("Times New Roman", 20,), padx=40, pady=20, command=lambda: button_click(6)) +button_7 = Button(root, text="7", bg="lightgrey", font=("Times New Roman", 20,), padx=40, pady=20, command=lambda: button_click(7)) +button_8 = Button(root, text="8", bg="lightgrey", font=("Times New Roman", 20,), padx=40, pady=20, command=lambda: button_click(8)) +button_9 = Button(root, text="9", bg="lightgrey", font=("Times New Roman", 20,), padx=40, pady=20, command=lambda: button_click(9)) +button_0 = Button(root, text="0", bg="lightgrey", font=("Times New Roman", 20,), padx=40, pady=20, command=lambda: button_click(0)) +button_add = Button(root, text="+", bg="lightgrey", font=("Times New Roman", 20,), padx=39, pady=20, command=button_add) +button_subtract = Button(root, text="-", bg="lightgrey", font=("Times New Roman", 20,), padx=40, pady=20, command=button_subract) +button_multiply = Button(root, text="×", bg="lightgrey", font=("Times New Roman", 20,), padx=39, pady=20, command=button_multiply) +button_divide = Button(root, text="÷", bg="lightgrey", font=("Times New Roman", 20,), padx=39, pady=20, command=button_divide) button_equal = Button(root, bg="skyblue", font=("Times New Roman", 20,), text="=", padx=39, pady=20, command=button_equal) button_clear = Button(root, text="Clear", bg="red", font=("Times New Roman", 20, ""), padx=20, pady=20, diff --git a/Image Insertion.py b/Image Insertion.py new file mode 100644 index 0000000..13a57f8 --- /dev/null +++ b/Image Insertion.py @@ -0,0 +1,71 @@ +from tkinter import * +from PIL import ImageTk, Image + +root = Tk() + +root.title("Image Insertion") +root.iconbitmap("image.ico") + +my_image1 = ImageTk.PhotoImage(Image.open("facebook.png")) +my_image2 = ImageTk.PhotoImage(Image.open("messenger.png")) +my_image3 = ImageTk.PhotoImage(Image.open("twitter.png")) +my_image4 = ImageTk.PhotoImage(Image.open("youtube.png")) +my_image5 = ImageTk.PhotoImage(Image.open("google.png")) + +image_list = [my_image1, my_image2, my_image3, my_image4, my_image5] + + +my_label = Label(image=my_image1) +my_label.grid(row=0, column=0, columnspan=3) + +def forward(image_number): + global my_label + global button_forward + global button_back + + my_label.grid_forget() + my_label = Label(image=image_list[image_number-1]) + button_forward = Button(root, text=">>", command=lambda: forward(image_number+1)) + button_back = Button(root, text="<<", command=lambda: back(image_number-1)) + + if image_number == 5: + button_forward = Button(root, text=">>", state=DISABLED) + + my_label.grid(row=0, column=0, columnspan=3) + button_back.grid(row=1, column=0) + button_forward.grid(row=1, column=2) + + if image_number == 5: + button_forward = Button(root, text=">>", state=DISABLED) + + +def back(image_number): + global my_label + global button_forward + global button_back + + my_label.grid_forget() + my_label = Label(image=image_list[image_number -1]) + button_forward = Button(root, text=">>", command=lambda: forward(image_number+1)) + button_back = Button(root, text="<<", command=lambda: back(image_number-1)) + + if image_number == 1: + button_back = Button(root, text="<<", state=DISABLED) + + my_label.grid(row=0, column=0, columnspan=3) + button_back.grid(row=1, column=0) + button_forward.grid(row=1, column=2) + + + + +button_back = Button(root, text="<<", command=lambda: back, state=DISABLED) +button_back.grid(row=1, column=0) + +button_exit = Button(root, text="Exit", command=root.quit) +button_exit.grid(row=1, column=1, ) + +button_forward = Button(root, text=">>", command=lambda: forward(2)) +button_forward.grid(row=1,column=2) + +root.mainloop() \ No newline at end of file diff --git a/calculator.ico b/calculator.ico new file mode 100644 index 0000000..5690b21 Binary files /dev/null and b/calculator.ico differ diff --git a/facebook.png b/facebook.png new file mode 100644 index 0000000..e395d04 Binary files /dev/null and b/facebook.png differ diff --git a/google.png b/google.png new file mode 100644 index 0000000..464ee64 Binary files /dev/null and b/google.png differ diff --git a/photo.png b/img.png similarity index 100% rename from photo.png rename to img.png diff --git a/main.py b/main.py index 0fc1c88..02eae6b 100644 --- a/main.py +++ b/main.py @@ -6,7 +6,7 @@ def myClick(): textoutput = 'Hello,' + e1.get() - myLabel = Label(root, text = textoutput) + myLabel = Label(root,fg= "red", text = textoutput) myLabel.pack() diff --git a/messenger.png b/messenger.png new file mode 100644 index 0000000..2380ad8 Binary files /dev/null and b/messenger.png differ diff --git a/photoo.png b/photoo.png new file mode 100644 index 0000000..eff694d Binary files /dev/null and b/photoo.png differ diff --git a/test.py b/test.py index 320b489..3d86873 100644 --- a/test.py +++ b/test.py @@ -4,7 +4,7 @@ root = Tk() #title -root.ttle("Image Insertion") +root.title("Image Insertion") #icon images # png icons does not support sometimes diff --git a/twitter.png b/twitter.png new file mode 100644 index 0000000..bed2548 Binary files /dev/null and b/twitter.png differ diff --git a/venv/photoo.png b/venv/photoo.png new file mode 100644 index 0000000..eff694d Binary files /dev/null and b/venv/photoo.png differ diff --git a/youtube.png b/youtube.png new file mode 100644 index 0000000..bb83d84 Binary files /dev/null and b/youtube.png differ