├── Instant News Headlines (Tkinter + NewsApi)
├── .idea
│ ├── .name
│ ├── .gitignore
│ ├── misc.xml
│ ├── vcs.xml
│ ├── inspectionProfiles
│ │ └── profiles_settings.xml
│ ├── modules.xml
│ └── News Headlines Sender.iml
├── download.png
├── newsicon.png
├── —Pngtree—vector creative hot news tag_4265321.png
├── hackerrank.py
├── ReadMe
├── apitesting.py
└── main.py
├── sms
├── Sms.ico
├── background.jpg
└── send_sms.py
├── Dictionary
├── dict.png
└── dictionary.py
├── Notepad
├── notepad.ico
└── notepad.py
├── currency
├── icon.ico
├── currency.png
└── currency-converter.py
├── calender
├── calendar.png
└── calender.py
├── Billing System
├── Bill.PNG
└── billing_system.py
├── Email Sender
├── gmail.png
└── send_email.py
├── Google Engine
├── Google.ico
├── Search.ico
├── Search.png
├── apps.jpg
├── gmail.jpg
├── youtube.png
├── google logo.png
├── Google drive.png
└── google-search-engine.py
├── Paint Application
├── pen.png
├── brush.png
├── color.png
├── eraser.png
└── paint.py
├── Translator
├── translator.png
└── translator.py
├── youtube-downloader
├── yt.png
├── Youtube.ico
├── youtube.png
└── yt-downloader.py
├── Piano Application
├── Piano1.mp3
├── Piano10.mp3
├── Piano11.mp3
├── Piano12.mp3
├── Piano13.mp3
├── Piano14.mp3
├── Piano15.mp3
├── Piano16.mp3
├── Piano17.mp3
├── Piano18.mp3
├── Piano19.mp3
├── Piano2.mp3
├── Piano20.mp3
├── Piano21.mp3
├── Piano22.mp3
├── Piano23.mp3
├── Piano3.mp3
├── Piano4.mp3
├── Piano5.mp3
├── Piano6.mp3
├── Piano7.mp3
├── Piano8.mp3
├── Piano9.mp3
├── piano.png
└── piano.py
├── images
└── Screenshot (293).png
├── weather application
├── icon.png
├── icon2.png
├── icon3.png
├── icon4.png
├── icon5.png
└── weather.py
├── cafe management system
├── cafe.png
├── false.png
└── cafe-management.py
├── Calculator with Images
├── Calc-icon.ico
├── 300x430_background.png
├── calculator_buttons_50x50
│ ├── 1.png
│ ├── 10.png
│ ├── 11.png
│ ├── 12.png
│ ├── 13.png
│ ├── 14.png
│ ├── 15.png
│ ├── 16.png
│ ├── 2.png
│ ├── 3.png
│ ├── 4.png
│ ├── 5.png
│ ├── 6.png
│ ├── 7.png
│ ├── 8.png
│ └── 9.png
└── calculator_with_images.py
├── Advance Youtube Downloader
├── youtube.png
└── yt-downloader.py
├── tkinter-4.py
├── tkinter-3.py
├── tkinter-5.py
├── Tic Tac Toe Game
├── README.md
└── tic_tac_toe.py
├── tkinter-1.py
├── tkinter-2.py
├── tkinter-6.py
├── LICENSE
├── README.md
├── tkinter-7.py
├── Restruant Management System
└── readme.txt
├── calculator
├── calculator2.py
└── tk-calculator.py
├── url shortner
└── url-shortner.py
├── Name Generators
└── name-generator.py
├── Pomodrone
└── pomodrone.py
├── Insta User Details
└── insta-user-details.py
└── compound_Interest.py
└── compundinterest.py
/Instant News Headlines (Tkinter + NewsApi)/.idea/.name:
--------------------------------------------------------------------------------
1 | main.py
--------------------------------------------------------------------------------
/sms/Sms.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/sms/Sms.ico
--------------------------------------------------------------------------------
/Dictionary/dict.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Dictionary/dict.png
--------------------------------------------------------------------------------
/Notepad/notepad.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Notepad/notepad.ico
--------------------------------------------------------------------------------
/currency/icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/currency/icon.ico
--------------------------------------------------------------------------------
/sms/background.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/sms/background.jpg
--------------------------------------------------------------------------------
/calender/calendar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/calender/calendar.png
--------------------------------------------------------------------------------
/currency/currency.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/currency/currency.png
--------------------------------------------------------------------------------
/Billing System/Bill.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Billing System/Bill.PNG
--------------------------------------------------------------------------------
/Email Sender/gmail.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Email Sender/gmail.png
--------------------------------------------------------------------------------
/Google Engine/Google.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Google Engine/Google.ico
--------------------------------------------------------------------------------
/Google Engine/Search.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Google Engine/Search.ico
--------------------------------------------------------------------------------
/Google Engine/Search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Google Engine/Search.png
--------------------------------------------------------------------------------
/Google Engine/apps.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Google Engine/apps.jpg
--------------------------------------------------------------------------------
/Google Engine/gmail.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Google Engine/gmail.jpg
--------------------------------------------------------------------------------
/Instant News Headlines (Tkinter + NewsApi)/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/Google Engine/youtube.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Google Engine/youtube.png
--------------------------------------------------------------------------------
/Paint Application/pen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Paint Application/pen.png
--------------------------------------------------------------------------------
/Translator/translator.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Translator/translator.png
--------------------------------------------------------------------------------
/youtube-downloader/yt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/youtube-downloader/yt.png
--------------------------------------------------------------------------------
/Google Engine/google logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Google Engine/google logo.png
--------------------------------------------------------------------------------
/Paint Application/brush.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Paint Application/brush.png
--------------------------------------------------------------------------------
/Paint Application/color.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Paint Application/color.png
--------------------------------------------------------------------------------
/Paint Application/eraser.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Paint Application/eraser.png
--------------------------------------------------------------------------------
/Piano Application/Piano1.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Piano Application/Piano1.mp3
--------------------------------------------------------------------------------
/Piano Application/Piano10.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Piano Application/Piano10.mp3
--------------------------------------------------------------------------------
/Piano Application/Piano11.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Piano Application/Piano11.mp3
--------------------------------------------------------------------------------
/Piano Application/Piano12.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Piano Application/Piano12.mp3
--------------------------------------------------------------------------------
/Piano Application/Piano13.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Piano Application/Piano13.mp3
--------------------------------------------------------------------------------
/Piano Application/Piano14.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Piano Application/Piano14.mp3
--------------------------------------------------------------------------------
/Piano Application/Piano15.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Piano Application/Piano15.mp3
--------------------------------------------------------------------------------
/Piano Application/Piano16.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Piano Application/Piano16.mp3
--------------------------------------------------------------------------------
/Piano Application/Piano17.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Piano Application/Piano17.mp3
--------------------------------------------------------------------------------
/Piano Application/Piano18.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Piano Application/Piano18.mp3
--------------------------------------------------------------------------------
/Piano Application/Piano19.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Piano Application/Piano19.mp3
--------------------------------------------------------------------------------
/Piano Application/Piano2.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Piano Application/Piano2.mp3
--------------------------------------------------------------------------------
/Piano Application/Piano20.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Piano Application/Piano20.mp3
--------------------------------------------------------------------------------
/Piano Application/Piano21.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Piano Application/Piano21.mp3
--------------------------------------------------------------------------------
/Piano Application/Piano22.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Piano Application/Piano22.mp3
--------------------------------------------------------------------------------
/Piano Application/Piano23.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Piano Application/Piano23.mp3
--------------------------------------------------------------------------------
/Piano Application/Piano3.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Piano Application/Piano3.mp3
--------------------------------------------------------------------------------
/Piano Application/Piano4.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Piano Application/Piano4.mp3
--------------------------------------------------------------------------------
/Piano Application/Piano5.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Piano Application/Piano5.mp3
--------------------------------------------------------------------------------
/Piano Application/Piano6.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Piano Application/Piano6.mp3
--------------------------------------------------------------------------------
/Piano Application/Piano7.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Piano Application/Piano7.mp3
--------------------------------------------------------------------------------
/Piano Application/Piano8.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Piano Application/Piano8.mp3
--------------------------------------------------------------------------------
/Piano Application/Piano9.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Piano Application/Piano9.mp3
--------------------------------------------------------------------------------
/Piano Application/piano.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Piano Application/piano.png
--------------------------------------------------------------------------------
/images/Screenshot (293).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/images/Screenshot (293).png
--------------------------------------------------------------------------------
/weather application/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/weather application/icon.png
--------------------------------------------------------------------------------
/weather application/icon2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/weather application/icon2.png
--------------------------------------------------------------------------------
/weather application/icon3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/weather application/icon3.png
--------------------------------------------------------------------------------
/weather application/icon4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/weather application/icon4.png
--------------------------------------------------------------------------------
/weather application/icon5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/weather application/icon5.png
--------------------------------------------------------------------------------
/Google Engine/Google drive.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Google Engine/Google drive.png
--------------------------------------------------------------------------------
/cafe management system/cafe.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/cafe management system/cafe.png
--------------------------------------------------------------------------------
/youtube-downloader/Youtube.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/youtube-downloader/Youtube.ico
--------------------------------------------------------------------------------
/youtube-downloader/youtube.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/youtube-downloader/youtube.png
--------------------------------------------------------------------------------
/cafe management system/false.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/cafe management system/false.png
--------------------------------------------------------------------------------
/Calculator with Images/Calc-icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Calculator with Images/Calc-icon.ico
--------------------------------------------------------------------------------
/Advance Youtube Downloader/youtube.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Advance Youtube Downloader/youtube.png
--------------------------------------------------------------------------------
/Calculator with Images/300x430_background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Calculator with Images/300x430_background.png
--------------------------------------------------------------------------------
/Calculator with Images/calculator_buttons_50x50/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Calculator with Images/calculator_buttons_50x50/1.png
--------------------------------------------------------------------------------
/Calculator with Images/calculator_buttons_50x50/10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Calculator with Images/calculator_buttons_50x50/10.png
--------------------------------------------------------------------------------
/Calculator with Images/calculator_buttons_50x50/11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Calculator with Images/calculator_buttons_50x50/11.png
--------------------------------------------------------------------------------
/Calculator with Images/calculator_buttons_50x50/12.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Calculator with Images/calculator_buttons_50x50/12.png
--------------------------------------------------------------------------------
/Calculator with Images/calculator_buttons_50x50/13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Calculator with Images/calculator_buttons_50x50/13.png
--------------------------------------------------------------------------------
/Calculator with Images/calculator_buttons_50x50/14.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Calculator with Images/calculator_buttons_50x50/14.png
--------------------------------------------------------------------------------
/Calculator with Images/calculator_buttons_50x50/15.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Calculator with Images/calculator_buttons_50x50/15.png
--------------------------------------------------------------------------------
/Calculator with Images/calculator_buttons_50x50/16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Calculator with Images/calculator_buttons_50x50/16.png
--------------------------------------------------------------------------------
/Calculator with Images/calculator_buttons_50x50/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Calculator with Images/calculator_buttons_50x50/2.png
--------------------------------------------------------------------------------
/Calculator with Images/calculator_buttons_50x50/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Calculator with Images/calculator_buttons_50x50/3.png
--------------------------------------------------------------------------------
/Calculator with Images/calculator_buttons_50x50/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Calculator with Images/calculator_buttons_50x50/4.png
--------------------------------------------------------------------------------
/Calculator with Images/calculator_buttons_50x50/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Calculator with Images/calculator_buttons_50x50/5.png
--------------------------------------------------------------------------------
/Calculator with Images/calculator_buttons_50x50/6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Calculator with Images/calculator_buttons_50x50/6.png
--------------------------------------------------------------------------------
/Calculator with Images/calculator_buttons_50x50/7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Calculator with Images/calculator_buttons_50x50/7.png
--------------------------------------------------------------------------------
/Calculator with Images/calculator_buttons_50x50/8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Calculator with Images/calculator_buttons_50x50/8.png
--------------------------------------------------------------------------------
/Calculator with Images/calculator_buttons_50x50/9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Calculator with Images/calculator_buttons_50x50/9.png
--------------------------------------------------------------------------------
/Instant News Headlines (Tkinter + NewsApi)/download.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Instant News Headlines (Tkinter + NewsApi)/download.png
--------------------------------------------------------------------------------
/Instant News Headlines (Tkinter + NewsApi)/newsicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Instant News Headlines (Tkinter + NewsApi)/newsicon.png
--------------------------------------------------------------------------------
/tkinter-4.py:
--------------------------------------------------------------------------------
1 | import tkinter as tk
2 |
3 | root = tk.Tk()
4 | root.title("My Gui")
5 | root.geometry("250x150")
6 |
7 | #changing bg value
8 | root['bg'] = "cyan"
9 |
10 | root.mainloop()
11 |
--------------------------------------------------------------------------------
/Instant News Headlines (Tkinter + NewsApi)/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Instant News Headlines (Tkinter + NewsApi)/—Pngtree—vector creative hot news tag_4265321.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aashishkumar123/Python-GUI-Project/HEAD/Instant News Headlines (Tkinter + NewsApi)/—Pngtree—vector creative hot news tag_4265321.png
--------------------------------------------------------------------------------
/Instant News Headlines (Tkinter + NewsApi)/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/tkinter-3.py:
--------------------------------------------------------------------------------
1 | from tkinter import *
2 | import tkinter as tk
3 | root = tk.Tk()
4 | root.title('Instagram')
5 |
6 | #iconbitmap() method is used to set the icon in a GUI window.
7 | root.iconbitmap(r'C:\Users\USER\Desktop\instagram.ico')
8 |
9 | root.mainloop()
10 |
--------------------------------------------------------------------------------
/Instant News Headlines (Tkinter + NewsApi)/.idea/inspectionProfiles/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Instant News Headlines (Tkinter + NewsApi)/hackerrank.py:
--------------------------------------------------------------------------------
1 | n=int(input())
2 |
3 | if(n%2!=0):
4 | print("Weird")
5 | else:
6 | if n>=2 & n<=5:
7 | print("Not Weird")
8 | elif n>=6 & n<=20:
9 | print("Weird")
10 | elif n>20:
11 | print("Not Weird")
--------------------------------------------------------------------------------
/tkinter-5.py:
--------------------------------------------------------------------------------
1 | from tkinter import *
2 | from PIL import ImageTk, Image
3 |
4 | root = Tk()
5 | root.title("my GUI")
6 | root.geometry("250x150")
7 | img = ImageTk.PhotoImage(Image.open(r'C:\Users\USER\Desktop\image-16.jpg'))
8 | panel = Label(root, image = img)
9 | panel.pack(side = "bottom", fill = "both", expand = "yes")
10 | root.mainloop()
11 |
--------------------------------------------------------------------------------
/Instant News Headlines (Tkinter + NewsApi)/ReadMe:
--------------------------------------------------------------------------------
1 | This is Simple News Headline Application made in Python with NewsAPi and Gui using TKinter
2 |
3 | Here are the TWo options :
4 | 1. Get headlines of your choice= in which we give different parameters given by user and get news from around the world.
5 | 2. This end give and generate random headlines.
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Instant News Headlines (Tkinter + NewsApi)/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Instant News Headlines (Tkinter + NewsApi)/.idea/News Headlines Sender.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Tic Tac Toe Game/README.md:
--------------------------------------------------------------------------------
1 |
2 | # Tic Tac Toe
3 |
4 |
5 | ## Description
6 |
7 | A Tic Tac Toe game built in Python.
8 |
9 | ## Library Used
10 | `import tkinter`
11 |
12 | ## How to run
13 | Running the script is really simple! Just open a terminal in the folder where your script is located and run the following command:
14 |
15 | ```sh
16 | python tic_tac_toe.py
17 | ```
18 |
19 | ## Author
20 | [Anokh1](https://github.com/Anokh1)
21 |
22 |
--------------------------------------------------------------------------------
/tkinter-1.py:
--------------------------------------------------------------------------------
1 | #importing
2 | from tkinter import *
3 | import tkinter as tk
4 |
5 | #calling Tk() method
6 | root = tk.Tk()
7 | #its used for creating gui window
8 |
9 | #title() method is used to change the title
10 | root.title("My GUI")
11 |
12 | #geometry() method is used to resize the Gui Window
13 | root.geometry("250x250")
14 |
15 | #maxsize() method is used for define the maximum size of the window
16 | root.maxsize(300,300)
17 |
18 | #minsize() method is used for define the minimum size of the window
19 | root.minsize(200,200)
20 |
21 | #mainloop() is used to load the GUI Window
22 | root.mainloop()
23 |
--------------------------------------------------------------------------------
/Instant News Headlines (Tkinter + NewsApi)/apitesting.py:
--------------------------------------------------------------------------------
1 | import requests
2 | import tkinter as tk
3 | def getnews():
4 | api_key="a8ab6d9bd5684d27bab671e76c15eb91"
5 | url = "https://newsapi.org/v2/top-headlines?country=US&category=business&apiKey="+api_key
6 | news=requests.get(url).json()
7 | articles = news["articles"]
8 | my_articles =[]
9 | my_news=""
10 |
11 | for article in articles:
12 | my_articles.append(article["title"])
13 |
14 | for i in range(10):
15 | my_news = my_news + my_articles[i] + "\n"
16 |
17 | label.config(text=my_news)
18 |
19 | canvas = tk.Tk()
20 | canvas.geometry("1000x400")
21 | canvas.title("News App")
22 |
23 |
24 | button=tk.Button(canvas,font =24,text="GetHeadLines",command=getnews)
25 | button.pack(pady = 20)
26 |
27 | label=tk.Label(canvas,font = 18,justify = "left")
28 | label.pack(pady =20)
29 |
30 | canvas.mainloop()
31 |
32 |
33 |
--------------------------------------------------------------------------------
/tkinter-2.py:
--------------------------------------------------------------------------------
1 | # import tkinter module
2 | from tkinter import *
3 | import tkinter as tk
4 |
5 | # creating main tkinter window/toplevel
6 | root = tk.Tk()
7 |
8 | root.geometry("230x120")
9 | root.title('Form')
10 |
11 | # Lable() function creates a label widget
12 |
13 | l1 = Label(root, text = "Email:")
14 | l2 = Label(root, text = "Password:")
15 |
16 | # grid method to arrange labels in respective
17 | # rows and columns as specified
18 |
19 | l1.grid(row = 1, column = 1, pady = 10,padx=15)
20 | l2.grid(row = 2, column = 1, pady = 4,padx=15)
21 |
22 | # entry widgets, used to take entry from user
23 | e1 = Entry(root)
24 | e2 = Entry(root)
25 |
26 | # this will arrange entry widgets
27 | e1.grid(row = 1, column = 2, pady = 10)
28 | e2.grid(row = 2, column = 2, pady = 4)
29 |
30 | # Button() function is used to create button widgets
31 | submit = Button(root,text="submit")
32 | submit.grid(column=2,row=3,pady="3")
33 | mainloop()
34 |
--------------------------------------------------------------------------------
/tkinter-6.py:
--------------------------------------------------------------------------------
1 | import tkinter as tk
2 | from tkinter import *
3 | import tkinter.font as TkFont
4 | root = tk.Tk()
5 | root.title('Form')
6 | root.geometry("350x200")
7 |
8 |
9 |
10 | font1 = TkFont.Font(family="Times",size=10,weight="bold")
11 | font2 = TkFont.Font(family="Helvetica",size=12,weight="bold")
12 | font3 = TkFont.Font(family="verdana",size=15,weight="bold")
13 | font4 = TkFont.Font(family="opensans",size=20,weight="bold")
14 | font5 = TkFont.Font(family="Symbol",size=25,weight="bold")
15 |
16 |
17 | l1 = Label(root,text="This is first Font", font = font1,bg="red")
18 | l1.pack()
19 |
20 | l2 = Label(root,text="This is Second Font", font= font2,fg="red")
21 | l2.pack()
22 |
23 | l3 = Label(root,text="This is Third Font", font= font3)
24 | l3.pack()
25 |
26 | l4 = Label(root,text="This is Fourth Font", font= font4, fg="cyan")
27 | l4.pack()
28 |
29 | l5 = Label(root,text="This is Fifth Font", font= font5, fg="white",bg="black")
30 | l5.pack()
31 |
32 | l6 = Label(root,text="This is Last Font", font=("verdana",10,"bold"))
33 | l6.pack()
34 |
35 | root.mainloop()
36 |
37 |
38 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Aashishkumar123
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Piano Application/piano.py:
--------------------------------------------------------------------------------
1 | from tkinter import *
2 | import tkinter as tk
3 | from PIL import ImageTk, Image
4 | from playsound import playsound
5 | root = tk.Tk()
6 | root.geometry('700x300')
7 | root.title("piano")
8 | root.maxsize(700,300)
9 | root.minsize(700,300)
10 | root['bg']="white"
11 | icon = ImageTk.PhotoImage(Image.open('piano.png'))
12 | icon_label = Label(root,image=icon)
13 | icon_label.place(x=295,y=10)
14 | frame1 = Frame(root,width=700,height=198,bg="white")
15 | frame1.place(x=0,y=100)
16 | class piano():
17 | def PianoSound(self,sound):
18 | playsound(f'Piano{sound}.mp3')
19 | def __init__(self,index):
20 | self.index = index
21 | if self.index%2 != 0:
22 | Button(frame1,padx=10,pady=100,bg="black",fg="white",relief=RAISED,borderwidth=3,command=lambda:self.PianoSound(self.index),cursor="hand2").grid(row=0,column=self.index)
23 | else:
24 | Button(frame1,padx=10,pady=100,bg="white",fg="black",relief=RAISED,borderwidth=2,command=lambda:self.PianoSound(self.index),cursor="hand2").grid(row=0,column=self.index)
25 | if __name__ == '__main__':
26 | for i in range(1,24):
27 | piano(i)
28 | root.mainloop()
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Python-GUI-Projects
2 |
3 |
4 | ## Description
5 |
6 | All the GUI projects that is built in Python.
7 |
8 | ## Library Used
9 | `import tkinter`
10 |
11 | ## How to run
12 | Running the script is really simple! Just open a terminal in the folder where your script is located and run the following command:
13 |
14 | ## Projects List
15 | `1. Advance Gui Youtube Downloader`
16 | `2. Dictionary Gui Application`
17 | `3. Email Sender Gui Application`
18 | `4. Instagram User detail Gui Application`
19 | `5. Name Generator Gui Application`
20 | `6. Notepad Gui Application`
21 | `7. Paint Gui Application`
22 | `8. Piano Gui Application`
23 | `9. Restruant Management System Gui Application`
24 | `10. Google Translator Gui Application`
25 | `11. Cafe Management System Gui Application`
26 | `12. Calculator Gui Application`
27 | `13. Calculator with Images Gui Application`
28 | `14. Calender Gui Application`
29 | `15. Currency Converter Gui Application`
30 | `16. SMS Sender Gui Application`
31 | `17. Url Shortener Gui Application`
32 | `18. Weather Gui Application`
33 | `19. Basic Gui Youtube Downloader`
34 | `20. Tic Tac Toe`
35 | `21. News Headlines Application`
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/tkinter-7.py:
--------------------------------------------------------------------------------
1 | import tkinter as tk
2 | from tkinter import *
3 | root = tk.Tk()
4 | root.title('Form')
5 | root.geometry("250x160")
6 |
7 | #variable
8 | var = IntVar()
9 | #label
10 | l1 = Label(root,text="Radio Buttons",font=("verdana",10,"bold"))
11 | l1.grid(sticky="w",padx=60)
12 |
13 | #radiobuttons
14 | r1 = Radiobutton(root,text="R1", value=1,variable=var)
15 | r1.grid(sticky="w",row=1,pady=10)
16 |
17 | r2 = Radiobutton(root,text="R2", value=2,variable=var,relief=RIDGE)
18 | r2.grid(sticky="w",row=1,padx=60,pady=10)
19 |
20 | r3 = Radiobutton(root,text="R3", value=3,variable=var,relief=SUNKEN)
21 | r3.grid(sticky="w",row=1,padx=120,pady=10)
22 |
23 | r4 = Radiobutton(root,text="R4", value=4,variable=var,relief=RIDGE,bg="red",fg="white")
24 | r4.grid(sticky="w",row=1,padx=180,pady=10)
25 |
26 | #label
27 | l2 = Label(root,text="Check Buttons",font=("verdana",10,"bold"))
28 | l2.grid(sticky="w",padx=60)
29 |
30 | #checkbuttons
31 | c1 = Checkbutton(root,text="C1")
32 | c1.grid(row=3,sticky="w",pady=10)
33 |
34 | c2 = Checkbutton(root,text="C2",relief=SUNKEN)
35 | c2.grid(row=3,sticky="w", padx=60,pady=10)
36 |
37 | c3 = Checkbutton(root,text="C3",relief=RIDGE)
38 | c3.grid(row=3,sticky="w", padx=120,pady=10)
39 |
40 | c4 = Checkbutton(root,text="C4",relief=SUNKEN,bg="cyan",fg="white")
41 | c4.grid(row=3,sticky="w", padx=180,pady=10)
42 |
43 | root.mainloop()
44 |
45 |
46 |
--------------------------------------------------------------------------------
/calender/calender.py:
--------------------------------------------------------------------------------
1 | from tkinter import *
2 | import tkinter as tk
3 | from PIL import ImageTk, Image
4 | import calendar
5 | root = tk.Tk()
6 | root.geometry('400x300')
7 | root.title('Calender')
8 |
9 |
10 | def show():
11 |
12 | m = int(month.get())
13 | y = int(year.get())
14 | output = calendar.month(y,m)
15 |
16 | cal.insert('end',output)
17 |
18 | def clear():
19 | cal.delete(1.0,'end')
20 |
21 | def exit():
22 | root.destroy()
23 |
24 |
25 |
26 |
27 |
28 | img = ImageTk.PhotoImage(Image.open('calendar.png'))
29 | label = Label(image=img)
30 | label.place(x=170,y=3)
31 |
32 |
33 |
34 | m_label = Label(root,text="Month",font=('verdana','10','bold'))
35 | m_label.place(x=70,y=80)
36 |
37 | month = Spinbox(root, from_= 1, to = 12,width="5")
38 | month.place(x=140,y=80)
39 |
40 | y_label = Label(root,text="Year",font=('verdana','10','bold'))
41 | y_label.place(x=210,y=80)
42 |
43 | year = Spinbox(root, from_= 2020, to = 3000,width="8")
44 | year.place(x=260,y=80)
45 |
46 |
47 | cal = Text(root,width=33,height=8,relief=RIDGE,borderwidth=2)
48 | cal.place(x=70,y=110)
49 |
50 | show = Button(root,text="Show",font=('verdana',10,'bold'),relief=RIDGE,borderwidth=2,command=show)
51 | show.place(x=140,y=250)
52 |
53 | clear = Button(root,text="Clear",font=('verdana',10,'bold'),relief=RIDGE,borderwidth=2,command=clear)
54 | clear.place(x=200,y=250)
55 |
56 | exit = Button(root,text="Exit",font=('verdana',10,'bold'),relief=RIDGE,borderwidth=2,command=exit)
57 | exit.place(x=260,y=250)
58 | root.mainloop()
--------------------------------------------------------------------------------
/Restruant Management System/readme.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 | ========== Small Description about the project ==============
4 |
5 | The project name is Restaurent Management System using python.
6 | You can add items like Drinks and Foods.
7 | Get the total amount of Drinks and Foods.
8 | Get the bill of the service charged, paid tax, and atlast get the total bills include service charged, tax and drinks and food you order.
9 | In this project a small calculator where you can calculate simple operations.
10 | In this project you can save the bill receipt , send the bill on your mobile phone.
11 |
12 | =======================================================
13 |
14 | ================== Features of the project ==================
15 |
16 | 1. Get the total cost of drinks & foods seprate
17 | 2. Get the total bill include with tax charges and service charges.
18 | 3. A small feature of calculator and perform some simple task.
19 | 4. You can save the reciept of the bill.
20 | 5. You can send the bill on your mobile phone.
21 | 6. Reset all the bill
22 | 7. Great Validation on this application.
23 | 8. Exit Features in the application.
24 |
25 | ======================================================
26 |
27 | =============== SMS Feature ==========================
28 |
29 | To get the sms feature on this project where you can send bill on your mobile number through sms.
30 | Go the offical website of www.fast2sms.com and signup here to get the free api.
31 | copy the api and paste in api variable in a send() function code..
32 |
33 | =====================================================
34 |
35 | --------------------------------------------------------------------------------------------------------------
36 |
--------------------------------------------------------------------------------
/sms/send_sms.py:
--------------------------------------------------------------------------------
1 | import tkinter as tk
2 | from tkinter import *
3 | from tkinter import messagebox
4 | from PIL import ImageTk, Image
5 | import requests
6 | root = tk.Tk()
7 | root.geometry('500x300')
8 | root.maxsize(500,300)
9 | root.minsize(500,300)
10 | root.title('Send SMS')
11 | root.iconbitmap('Sms.ico')
12 |
13 | def send_sms():
14 | number = phone_no.get()
15 | messages = message.get("1.0","end-1c")
16 |
17 | url = "https://www.fast2sms.com/dev/bulk"
18 | api = "put your api here" #Go to fast2sms.com and signup to get the free Api
19 | querystring = {"authorization":api,"sender_id":"FSTSMS","message":messages,"language":"english","route":"p","numbers":number}
20 |
21 | headers = {
22 | 'cache-control': "no-cache"
23 | }
24 | requests.request("GET", url, headers=headers, params=querystring)
25 | messagebox.showinfo("Send SMS",'SMS has been send successfully')
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 | img = ImageTk.PhotoImage(Image.open('background.jpg'))
36 | panel = Label(root, image = img)
37 | panel.pack(side = "bottom", fill = "both", expand = "yes")
38 |
39 |
40 | label = Label(root,text="Send SMS Using Python",font=('verdana',10,'bold'))
41 | label.place(x=210,y=10)
42 |
43 | phone_no = Entry(root,width=20,borderwidth=0,font=('verdana',10,'bold'))
44 | phone_no.place(x=220,y=115)
45 | phone_no.insert('end','phone number')
46 |
47 | message = Text(root,height=5,width=25,borderwidth=0,font=('verdana',10,'bold'))
48 | message.place(x=190,y=140)
49 | message.insert('end','Message')
50 |
51 | send = Button(root,text="Send Message",font=('verdana',10,'bold'),relief=RIDGE,cursor='hand2',borderwidth=0,command=send_sms)
52 | send.place(x=260,y=235)
53 | root.mainloop()
54 |
--------------------------------------------------------------------------------
/calculator/calculator2.py:
--------------------------------------------------------------------------------
1 | # Inspirado no programa 'clac1.py' do livro "Python and Tkinter Programming" de John E.Grayson
2 | from tkinter import *
3 |
4 | def frame(root, side):
5 | w = Frame(master=root)
6 | w.pack(side=side, expand=True, fill=BOTH, padx=(5, 0))
7 | return w
8 |
9 | def button(root, text, side, command=None, **kw):
10 | w = Button(master=root, text=text,
11 | command=command, relief=RIDGE, **kw)
12 | w.pack(side=side, expand=True, fill=BOTH)
13 | return w
14 |
15 | root = Frame()
16 | display = StringVar()
17 | frame_top = Frame(root,)
18 | frame_top.pack(side=TOP, fill=BOTH, expand=YES)
19 | Entry(master=frame_top, relief=SUNKEN,
20 | textvariable=display, state=DISABLED).pack(side=LEFT, expand=YES, fill=BOTH, padx=5, pady=2)
21 | Button(frame_top, text="C",
22 | command=lambda w=display: w.set(''),
23 | bg="red", fg="white", relief=RIDGE).pack(side=RIGHT, expand=False, padx=2)
24 |
25 |
26 | for i in "987+ 654- 321* 0d./".split():
27 | frame2buttons = frame(root, TOP)
28 | for char in i:
29 | if char == "d":
30 | button(frame2buttons, "00", LEFT,
31 | lambda w=display: w.set(w.get()+"00"))
32 | else:
33 |
34 | button(frame2buttons,char,LEFT,
35 | lambda w=display, c='%s' % char: w.set(w.get()+c))
36 |
37 |
38 | def result(w, e=None):
39 | s = w.get()
40 | if '%' in s:
41 | index = list(s).index('%')
42 | list_s = list(s)
43 | list_s.insert(0, '(')
44 | list_s.insert(index+1, ')/100')
45 | list_s[index+2] = '*'
46 | s = ''.join(list_s)
47 |
48 | w.set(eval(s))
49 |
50 | frame_bottom = frame(root, BOTTOM)
51 | button(frame_bottom, "=", LEFT, command=lambda w=display: result(w), bg="red", fg="white")
52 | Button(master=frame_bottom, text="%", relief=RIDGE, command=lambda w=display: w.set(w.get()+"%")).pack(side=LEFT, expand=False)
53 |
54 | root.pack(side=TOP, fill=BOTH, expand=True)
55 | root.mainloop()
56 |
--------------------------------------------------------------------------------
/url shortner/url-shortner.py:
--------------------------------------------------------------------------------
1 | from tkinter import *
2 | import tkinter as tk
3 | from datetime import datetime
4 | from tkinter import messagebox
5 | import pyshorteners
6 |
7 |
8 |
9 | class url_shortner:
10 |
11 |
12 | def create(self):
13 | if self.url.get() == "":
14 | messagebox.showerror("Error","Please Paste an URL")
15 | else:
16 | self.urls = self.url.get()
17 | self.s = pyshorteners.Shortener()
18 | self.short_url = self.s.tinyurl.short(self.urls)
19 |
20 | self.output = Entry(self.root,font=('verdana',10,'bold'),fg="purple",width=30,relief=GROOVE,borderwidth=2,border=2)
21 | self.output.insert(END,self.short_url)
22 | self.output.place(x=80,y=120)
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | def __init__(self):
33 | self.root = tk.Tk()
34 | self.root.geometry('500x200')
35 | self.root.maxsize(500,200)
36 | self.root.minsize(500,200)
37 | self.root.title('Url Shortner')
38 | self.root['bg'] = "white"
39 |
40 | self.title = Label(self.root,text="URL Shortner",font=('verdana',15,'bold'),bg="white",fg="purple")
41 | self.title.place(x=180,y=5)
42 |
43 | self.date = Label(self.root,text=datetime.now().date(),fg="purple",font=('verdana',10,'bold'))
44 | self.date.place(x=400,y=5)
45 |
46 |
47 |
48 | Label(self.root,text="Paste Your Url Here ..",font=('verdana',10,'bold'),fg="purple").place(x=50,y=50)
49 |
50 | self.url = Entry(self.root,width=50,bg="lightgrey",relief=GROOVE,borderwidth=2,border=2)
51 | self.url.place(x=50,y=80)
52 |
53 | self.button = Button(self.root,relief=GROOVE,text="Create",font=('verdana',8,'bold'),bg="purple",fg="white",command=self.create)
54 | self.button.place(x=360,y=78)
55 | self.root.mainloop()
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 | if __name__ == '__main__':
67 | url_shortner()
68 |
69 |
--------------------------------------------------------------------------------
/Name Generators/name-generator.py:
--------------------------------------------------------------------------------
1 | from tkinter import *
2 | import tkinter as tk
3 | from tkinter.ttk import Combobox
4 | from tkinter.scrolledtext import ScrolledText
5 | import names
6 |
7 | root = tk.Tk()
8 | root.geometry('400x200')
9 | root.title("Name Generators")
10 |
11 |
12 |
13 | def search():
14 |
15 | Gender = gender.get()
16 | Type = types.get()
17 |
18 | if Gender == 'Male' and Type == "Full Name":
19 | name = names.get_full_name(gender="male")
20 | text.insert('end',name)
21 | elif Gender == 'Male' and Type == "First Name":
22 | name = names.get_first_name()
23 | text.insert('end',name)
24 | elif Gender == 'Male' and Type == "Last Name":
25 | name = names.get_last_name()
26 | text.insert('end',name)
27 |
28 | elif Gender == 'Female' and Type == "Full Name":
29 | name = names.get_full_name(gender="female")
30 | text.insert('end',name)
31 | elif Gender == 'Female' and Type == "First Name":
32 | name = names.get_first_name()
33 | text.insert('end',name)
34 | elif Gender == 'Female' and Type == "Last Name":
35 | name = names.get_last_name()
36 | text.insert('end',name)
37 |
38 |
39 |
40 |
41 | l = Label(root, text="Name Generators",font=('verdana',15,'bold'),bg="black",fg="white")
42 | l.place(x=110,y=10)
43 |
44 | l1 = Label(root,text="Gender",font=('verdana',10,'bold'))
45 | l1.place(x=10,y=60)
46 | g = tk.StringVar()
47 | gender = Combobox(root, width = 13, textvariable = g, state='readonly',font=('verdana',10,'bold'),)
48 | gender['values'] = ('Male', 'Female')
49 | gender.place(x=10,y=90)
50 | gender.current(0)
51 |
52 | l2 = Label(root,text="Type",font=('verdana',10,'bold'))
53 | l2.place(x=170,y=60)
54 | t = tk.StringVar()
55 | types = Combobox(root, width = 13, textvariable = t, state='readonly',font=('verdana',10,'bold'),)
56 | types['values'] = ('Full Name', 'First Name','Last Name')
57 | types.place(x=170,y=90)
58 | types.current(0)
59 |
60 |
61 | button = Button(root,text="Search",font=('verdana','10','bold'),command=search)
62 | button.place(x=320,y=85)
63 |
64 |
65 |
66 |
67 | text = ScrolledText(root,width=40,height=3)
68 | text['font'] = ("verdana",10,'bold')
69 | text.place(x=10,y=130)
70 |
71 |
72 |
73 |
74 | root.mainloop()
--------------------------------------------------------------------------------
/Pomodrone/pomodrone.py:
--------------------------------------------------------------------------------
1 | import tkinter as tk
2 | from tkinter import messagebox
3 | from PIL import Image, ImageTk
4 | from playsound import playsound
5 | import time
6 |
7 | class Pomodoro:
8 | def __init__(self, root):
9 | self.root = root
10 |
11 | def work_break(self, timer):
12 |
13 | # common block to display minutes
14 | # and seconds on GUI
15 | minutes, seconds = divmod(timer, 60)
16 | self.min.set(f"{minutes:02d}")
17 | self.sec.set(f"{seconds:02d}")
18 | self.root.update()
19 | time.sleep(1)
20 |
21 | def work(self):
22 | timer = 25*60
23 | while timer >= 0:
24 | pomo.work_break(timer)
25 | if timer == 0:
26 |
27 | # once work is done play
28 | # a sound and switch for break
29 | playsound("sound.ogg")
30 | messagebox.showinfo(
31 | "Good Job", "Take A Break, \
32 | nClick Break Button")
33 | timer -= 1
34 |
35 | def break_(self):
36 | timer = 5*60
37 | while timer >= 0:
38 | pomo.work_break(timer)
39 | if timer == 0:
40 |
41 | # once break is done,
42 | # switch back to work
43 | playsound("sound.ogg")
44 | messagebox.showinfo(
45 | "Times Up", "Get Back To Work, \
46 | nClick Work Button")
47 | timer -= 1
48 |
49 | def main(self):
50 |
51 | # GUI window configuration
52 | self.root.geometry("450x455")
53 | self.root.resizable(False, False)
54 | self.root.title("Pomodoro Timer")
55 |
56 | # label
57 | self.min = tk.StringVar(self.root)
58 | self.min.set("25")
59 | self.sec = tk.StringVar(self.root)
60 | self.sec.set("00")
61 |
62 | self.min_label = tk.Label(self.root,
63 | textvariable=self.min, font=(
64 | "arial", 22, "bold"), bg="red", fg='black')
65 | self.min_label.pack()
66 |
67 | self.sec_label = tk.Label(self.root,
68 | textvariable=self.sec, font=(
69 | "arial", 22, "bold"), bg="black", fg='white')
70 | self.sec_label.pack()
71 |
72 | # add background image for GUI using Canvas widget
73 | canvas = tk.Canvas(self.root)
74 | canvas.pack(expand=True, fill="both")
75 | img = Image.open('pomodoro.jpg')
76 | bg = ImageTk.PhotoImage(img)
77 | canvas.create_image(90, 10, image=bg, anchor="nw")
78 |
79 | # create three buttons with countdown function command
80 | btn_work = tk.Button(self.root, text="Start",
81 | bd=5, command=self.work,
82 | bg="red", font=(
83 | "arial", 15, "bold")).place(x=140, y=380)
84 | btn_break = tk.Button(self.root, text="Break",
85 | bd=5, command=self.break_,
86 | bg="red", font=(
87 | "arial", 15, "bold")).place(x=240, y=380)
88 |
89 | self.root.mainloop()
90 |
91 |
92 | if __name__ == '__main__':
93 | pomo = Pomodoro(tk.Tk())
94 | pomo.main()
95 |
--------------------------------------------------------------------------------
/Dictionary/dictionary.py:
--------------------------------------------------------------------------------
1 | from tkinter import *
2 | import tkinter as tk
3 | from tkinter import ttk
4 | from tkinter import messagebox
5 | from PIL import ImageTk, Image
6 | from PyDictionary import PyDictionary
7 | from googletrans import Translator
8 |
9 | root = tk.Tk()
10 | root.title('Dictionary')
11 | root.geometry('600x300')
12 | root['bg'] = 'white'
13 | frame = Frame(root,width=200,height=300,borderwidth=1,relief=RIDGE)
14 | frame.grid(sticky="W")
15 |
16 |
17 | def get_meaning():
18 | dictionary=PyDictionary()
19 | get_word = entry.get()
20 | langauages = langauage.get()
21 |
22 | if get_word == "":
23 | messagebox.showerror('Dictionary','please write the word')
24 |
25 | elif langauages == 'English-to-English':
26 | d = dictionary.meaning(get_word)
27 | output.insert('end',d['Noun'])
28 |
29 | elif langauages == 'English-to-Hindi':
30 | translator = Translator()
31 | t = translator.translate(get_word, dest='hi')
32 | output.insert('end',t.text)
33 |
34 | def quit():
35 | root.destroy()
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 | img = ImageTk.PhotoImage(Image.open('dict.png'))
49 | pic = Label(root, image = img)
50 | pic.place(x=40,y=70)
51 |
52 | word = Label(root,text="Enter Word",bg="white",font=('verdana',10,'bold'))
53 | word.place(x=250,y=23)
54 |
55 |
56 |
57 |
58 | a = tk.StringVar()
59 | langauage = ttk.Combobox(root, width = 20, textvariable = a, state='readonly',font=('verdana',10,'bold'),)
60 |
61 |
62 |
63 | langauage['values'] = (
64 | 'English-to-English',
65 | 'English-to-Hindi',
66 |
67 |
68 | )
69 |
70 | langauage.place(x=380,y=10)
71 | langauage.current(0)
72 |
73 |
74 |
75 |
76 |
77 |
78 | entry = Entry(root,width=50,borderwidth=2,relief=RIDGE)
79 | entry.place(x=250,y=50)
80 |
81 |
82 | search = Button(root,text="Search",font=('verdana',10,'bold'),cursor="hand2",relief=RIDGE,command=get_meaning)
83 | search.place(x=430,y=80)
84 |
85 | quit = Button(root,text="Quit",font=('verdana',10,'bold'),cursor="hand2",relief=RIDGE,command=quit)
86 | quit.place(x=510,y=80)
87 |
88 |
89 | meaning = Label(root,text="Meaning",bg="white",font=('verdana',15,'bold'))
90 | meaning.place(x=230,y=120)
91 |
92 | output = Text(root,height=8,width=40,borderwidth=2,relief=RIDGE)
93 | output.place(x=230,y=160)
94 |
95 |
96 |
97 |
98 |
99 |
100 | root.mainloop()
--------------------------------------------------------------------------------
/Insta User Details/insta-user-details.py:
--------------------------------------------------------------------------------
1 | from tkinter import *
2 | import tkinter as tk
3 | import requests
4 |
5 | root = tk.Tk()
6 | root.title("Instagram User Details")
7 | root.geometry('400x300')
8 |
9 |
10 |
11 | def search():
12 | u_name = user.get()
13 | url = f"https://www.instagram.com/{u_name}/?__a=1"
14 |
15 | data = requests.get(url).json()
16 | print(data)
17 |
18 |
19 |
20 | def pic():
21 | import webbrowser
22 | d = data['graphql']['user']['profile_pic_url']
23 | webbrowser.open(d)
24 |
25 |
26 | if details.get(1.0,END) != "":
27 | details.delete(1.0,END)
28 | details.insert(1.0,f"\t username : {data['graphql']['user']['username']} \n followers : {data['graphql']['user']['edge_followed_by']['count']} following : {data['graphql']['user']['edge_follow']['count']} \n full name : {data['graphql']['user']['full_name']} \n Total post : {data['graphql']['user']['edge_owner_to_timeline_media']['count']} category : {data['graphql']['user']['category_enum']} \n Email : {data['graphql']['user']['business_email']} \nbio-link:{data['graphql']['user']['external_url']}private account:{data['graphql']['user']['is_private']} || verified account:{data['graphql']['user']['is_verified']} bussiness account:{data['graphql']['user']['is_business_account']} \n \n see profile picture" )
29 |
30 | Button(innerframe1,text="click to see",relief=RAISED,borderwidth=2,font=('verdana',8,'bold'),bg='#248aa2',fg="white",command=pic).place(x=180,y=145)
31 |
32 | frame = Frame(root,width=400,height=300,relief=RIDGE,borderwidth=5,bg='#248aa2')
33 | frame.place(x=0,y=0)
34 |
35 | innerframe = LabelFrame(frame,width=380,height=50,relief=RIDGE,borderwidth=3,bg='#248aa2',highlightbackground="white", highlightcolor="white", highlightthickness=2)
36 | innerframe.place(x=5,y=5)
37 |
38 |
39 | user = Entry(frame,width=30,relief=RIDGE,borderwidth=3)
40 | user.place(x=70,y=15)
41 |
42 | search = Button(frame,text="Search",relief=RAISED,borderwidth=2,font=('verdana',8,'bold'),bg='#248aa2',fg="white",command=search)
43 | search.place(x=270,y=15)
44 |
45 |
46 | innerframe = LabelFrame(frame,width=380,height=240,relief=RIDGE,borderwidth=3,bg='#248aa2',highlightbackground="white", highlightcolor="white", highlightthickness=2)
47 | innerframe.place(x=5,y=45)
48 |
49 |
50 | innerframe1 = LabelFrame(innerframe,text="Users Details",width=370,height=230,highlightbackground="white", highlightcolor="white", highlightthickness=5,font=('verdana',10,'bold'))
51 | innerframe1.place(x=0,y=0)
52 |
53 |
54 | details = Text(innerframe1,height=12,width=47,relief=RIDGE,borderwidth=5,highlightbackground="white", highlightcolor="white",font=('courier',9,''))
55 | details.place(x=5,y=5)
56 |
57 | root.mainloop()
58 |
--------------------------------------------------------------------------------
/youtube-downloader/yt-downloader.py:
--------------------------------------------------------------------------------
1 | # ================================= Importing Suitable Libraries =========================================================
2 | import tkinter as tk
3 | from tkinter import *
4 | from PIL import ImageTk, Image
5 | from tkinter import messagebox
6 | #install through ->> pip install pytube3
7 | import pytube
8 | import time
9 |
10 | # ===================================== End ===============================================================
11 |
12 | #===================================== Adding Window Components =============================================
13 | #craeting main window
14 | root = tk.Tk()
15 | #window title
16 | root.title("Youtube Downloader")
17 | #window logo
18 | root.iconbitmap("Youtube.ico")
19 | #window size
20 | root.geometry("700x300")
21 | #window max-size
22 | root.maxsize(700,250)
23 | #window min-size
24 | root.minsize(700,300)
25 |
26 | # ================================ End =============================================================================
27 |
28 | #=================================== function code starts here ======================================================
29 | def download():
30 | link = text.get("1.0","end-1c")
31 |
32 | if link == '':
33 | messagebox.showerror("YouTube Downloader", "Please paste a link here")
34 | else:
35 | yt = pytube.YouTube(link)
36 | stream = yt.streams.first()
37 | time.sleep(2)
38 | text.delete(1.0,'end')
39 | text.insert('end','Wait Downloading ......')
40 | time.sleep(5)
41 | stream.download()
42 | messagebox.showinfo("YouTube Downloader",'Video has been download successfully')
43 |
44 | # ================================================= End =========================================================
45 |
46 | # ================================================ main design code =================================================
47 | # header label
48 | header = Label(root,bg="black",width="300",height="2")
49 | header.place(x=0,y=0)
50 |
51 | #youtube logo image
52 | yt_logo = ImageTk.PhotoImage(Image.open('youtube.png'))
53 | logo = Label(root, image = yt_logo,borderwidth=0)
54 | logo.place(x=10,y=10)
55 |
56 | #caption label
57 | caption = Label(root,text="YouTube Downloader",font=('verdana',10,'bold'))
58 | caption.place(x=50,y=10)
59 |
60 | #youtube logo image
61 | yt1_logo = ImageTk.PhotoImage(Image.open('yt.png'))
62 | logo1 = Label(root, image = yt1_logo,borderwidth=0)
63 | logo1.place(x=300,y=60)
64 |
65 | #text widgets to get the url
66 | text = Text(root,width=60,height=2,font=('verdana',10,'bold'))
67 | text.place(x=90,y=180)
68 | text.insert('end','Paste your video link here')
69 |
70 | #Download Buttons
71 | button = Button(root,text="Download",relief=RIDGE,font=('verdana',10,'bold'),bg="red",fg="white",command=download)
72 | button.place(x=330,y=220)
73 |
74 | #load the window
75 | root.mainloop()
76 |
77 | #======================================================== End ========================================================
78 |
--------------------------------------------------------------------------------
/compound_Interest.py/compundinterest.py:
--------------------------------------------------------------------------------
1 | # import all classes / functions from the tkinter
2 | from tkinter import *
3 |
4 | # Function for clearing the
5 | # contents of all entry boxes
6 | def clear_all() :
7 |
8 | # whole content of entry boxes is deleted
9 | principal_field.delete(0, END)
10 | rate_field.delete(0, END)
11 | time_field.delete(0, END)
12 | compound_field.delete(0, END)
13 |
14 | # set focus on the principal_field entry box
15 | principal_field.focus_set()
16 |
17 |
18 | # Function to find compound interest
19 | def calculate_ci():
20 |
21 | # get a content from entry box
22 | principal = int(principal_field.get())
23 |
24 | rate = float(rate_field.get())
25 |
26 | time = int(time_field.get())
27 |
28 | # Calculates compound interest
29 | CI = principal * (pow((1 + rate / 100), time))
30 |
31 | # insert method inserting the
32 | # value in the text entry box.
33 | compound_field.insert(10, CI)
34 |
35 |
36 |
37 | # Driver code
38 | if __name__ == "__main__" :
39 |
40 | # Create a GUI window
41 | root = Tk()
42 |
43 | # Set the background colour of GUI window
44 | root.configure(background = 'dark blue')
45 |
46 | # Set the configuration of GUI window
47 | root.geometry("400x250")
48 |
49 | # set the name of tkinter GUI window
50 | root.title("Compound Interest Calculator")
51 |
52 | # Create a Principal Amount : label
53 | label1 = Label(root, text = "Principal Amount(Rs) : ",
54 | fg = 'white', bg = 'red')
55 |
56 | # Create a Rate : label
57 | label2 = Label(root, text = "Rate(%) : ",
58 | fg = 'white', bg = 'red')
59 |
60 | # Create a Time : label
61 | label3 = Label(root, text = "Time(years) : ",
62 | fg = 'white', bg = 'red')
63 |
64 | # Create a Compound Interest : label
65 | label4 = Label(root, text = "Compound Interest : ",
66 | fg = 'white', bg = 'red')
67 |
68 | # grid method is used for placing
69 | # the widgets at respective positions
70 | # in table like structure .
71 |
72 | # padx keyword argument used to set padding along x-axis .
73 | # pady keyword argument used to set padding along y-axis .
74 | label1.grid(row = 1, column = 0, padx = 10, pady = 10)
75 | label2.grid(row = 2, column = 0, padx = 10, pady = 10)
76 | label3.grid(row = 3, column = 0, padx = 10, pady = 10)
77 | label4.grid(row = 5, column = 0, padx = 10, pady = 10)
78 |
79 | # Create a entry box
80 | # for filling or typing the information.
81 | principal_field = Entry(root)
82 | rate_field = Entry(root)
83 | time_field = Entry(root)
84 | compound_field = Entry(root)
85 |
86 | # grid method is used for placing
87 | # the widgets at respective positions
88 | # in table like structure .
89 |
90 | # padx keyword argument used to set padding along x-axis .
91 | # pady keyword argument used to set padding along y-axis .
92 | principal_field.grid(row = 1, column = 1, padx = 10, pady = 10)
93 | rate_field.grid(row = 2, column = 1, padx = 10, pady = 10)
94 | time_field.grid(row = 3, column = 1, padx = 10, pady = 10)
95 | compound_field.grid(row = 5, column = 1, padx = 10, pady = 10)
96 |
97 | # Create a Submit Button and attached
98 | # to calculate_ci function
99 | button1 = Button(root, text = "Submit", bg = "red",
100 | fg = "black", command = calculate_ci)
101 |
102 | # Create a Clear Button and attached
103 | # to clear_all function
104 | button2 = Button(root, text = "Clear", bg = "red",
105 | fg = "black", command = clear_all)
106 |
107 | button1.grid(row = 4, column = 1, pady = 10)
108 | button2.grid(row = 6, column = 1, pady = 10)
109 |
110 | # Start the GUI
111 | root.mainloop()
112 |
--------------------------------------------------------------------------------
/Paint Application/paint.py:
--------------------------------------------------------------------------------
1 | from tkinter import *
2 | from tkinter.colorchooser import askcolor
3 | from PIL import ImageTk, Image
4 |
5 | class Paint(object):
6 |
7 | DEFAULT_PEN_SIZE = 5.0
8 | DEFAULT_COLOR = 'black'
9 |
10 | def __init__(self):
11 | self.root = Tk()
12 | self.root.title('Paint')
13 | self.root.geometry('500x300')
14 | self.root.maxsize(500,300)
15 | self.root.minsize(500,300)
16 |
17 |
18 | self.paint_tools = Frame(self.root,width=100,height=300,relief=RIDGE,borderwidth=2)
19 | self.paint_tools.place(x=0,y=0)
20 |
21 | self.pen_logo = ImageTk.PhotoImage(Image.open('pen.png'))
22 | self.p = Label(self.paint_tools, text="pen",borderwidth=0,font=('verdana',10,'bold'))
23 | self.p.place(x=5,y=11)
24 | self.pen_button = Button(self.paint_tools,padx=6,image=self.pen_logo,borderwidth=2,command=self.use_pen)
25 | self.pen_button.place(x=60,y=10)
26 |
27 | self.brush_logo = ImageTk.PhotoImage(Image.open('brush.png'))
28 | self.b = Label(self.paint_tools,borderwidth=0,text='brush',font=('verdana',10,'bold'))
29 | self.b.place(x=5,y=40)
30 | self.brush_button = Button(self.paint_tools,image = self.brush_logo,borderwidth=2,command=self.use_brush)
31 | self.brush_button.place(x=60,y=40)
32 |
33 | self.color_logo = ImageTk.PhotoImage(Image.open('color.png'))
34 | self.cl = Label(self.paint_tools, text='color',font=('verdana',10,'bold'))
35 | self.cl.place(x=5,y=70)
36 | self.color_button = Button(self.paint_tools,image = self.color_logo,borderwidth=2,command=self.choose_color)
37 | self.color_button.place(x=60,y=70)
38 |
39 | self.eraser_logo = ImageTk.PhotoImage(Image.open('eraser.png'))
40 | self.e = Label(self.paint_tools, text='eraser',font=('verdana',10,'bold'))
41 | self.e.place(x=5,y=100)
42 | self.eraser_button = Button(self.paint_tools,image = self.eraser_logo,borderwidth=2,command=self.use_eraser)
43 | self.eraser_button.place(x=60,y=100)
44 |
45 | self.pen_size = Label(self.paint_tools,text="Pen Size",font=('verdana',10,'bold'))
46 | self.pen_size.place(x=15,y=250)
47 | self.choose_size_button = Scale(self.paint_tools, from_=1, to=10, orient=VERTICAL)
48 | self.choose_size_button.place(x=20,y=150)
49 |
50 |
51 |
52 |
53 | self.c = Canvas(self.root, bg='white', width=600, height=600,relief=RIDGE,borderwidth=0)
54 | self.c.place(x=100,y=0)
55 |
56 | self.setup()
57 | self.root.mainloop()
58 |
59 | def setup(self):
60 | self.old_x = None
61 | self.old_y = None
62 | self.line_width = self.choose_size_button.get()
63 | self.color = self.DEFAULT_COLOR
64 | self.eraser_on = False
65 | self.active_button = self.pen_button
66 | self.c.bind('', self.paint)
67 | self.c.bind('', self.reset)
68 |
69 | def use_pen(self):
70 | self.activate_button(self.pen_button)
71 |
72 | def use_brush(self):
73 | self.activate_button(self.brush_button)
74 |
75 | def choose_color(self):
76 | self.eraser_on = False
77 | self.color = askcolor(color=self.color)[1]
78 |
79 | def use_eraser(self):
80 | self.activate_button(self.eraser_button, eraser_mode=True)
81 |
82 | def activate_button(self, some_button, eraser_mode=False):
83 | self.active_button.config(relief=RAISED)
84 | some_button.config(relief=SUNKEN)
85 | self.active_button = some_button
86 | self.eraser_on = eraser_mode
87 |
88 | def paint(self, event):
89 | self.line_width = self.choose_size_button.get()
90 | paint_color = 'white' if self.eraser_on else self.color
91 | if self.old_x and self.old_y:
92 | self.c.create_line(self.old_x, self.old_y, event.x, event.y,
93 | width=self.line_width, fill=paint_color,
94 | capstyle=ROUND, smooth=TRUE, splinesteps=36)
95 | self.old_x = event.x
96 | self.old_y = event.y
97 |
98 | def reset(self, event):
99 | self.old_x, self.old_y = None, None
100 |
101 |
102 | if __name__ == '__main__':
103 | Paint()
--------------------------------------------------------------------------------
/calculator/tk-calculator.py:
--------------------------------------------------------------------------------
1 | #importing modules
2 | import tkinter as tk
3 | from tkinter import *
4 | #defining attributes of main window
5 | root = tk.Tk()
6 | root.geometry("170x230")
7 | root.title("Calculator")
8 | root.maxsize(170,230)
9 | root.minsize(170,230)
10 |
11 | #Entry Widgets to show calculations
12 | inp = Entry(root,width=16,borderwidth=3,relief=RIDGE)
13 | inp.grid(pady=10,row=0,sticky="w",padx=15)
14 |
15 |
16 | # <==================== Button Operation code starts here.. ==============>
17 |
18 |
19 | def result():
20 | try:
21 |
22 | if inp.get() == "":
23 | inp.insert("end","error")
24 | elif inp.get()[0] == "0":
25 | inp.delete(0,"end")
26 | inp.insert("end","error")
27 |
28 | else:
29 | res = inp.get()
30 | res = eval(res)
31 | inp.insert("end"," = ")
32 | inp.insert("end",res)
33 | except SyntaxError:
34 | inp.insert("end","invalid input")
35 | # <============ end code ================>
36 |
37 |
38 |
39 | # <============= Button Design Code starts here.. ==================>
40 | # using lambda instead of functions to make the use of buttons more clear
41 | clear = Button(root,text="C",width=2,command=lambda:inp.delete(0,"end"),bg="red",fg="white",relief=RIDGE)
42 | clear.grid(row=0,sticky="w",padx=125)
43 |
44 |
45 | nine = Button(text="9",width=2,command=lambda:inp.insert("end","9"),borderwidth=3,relief=RIDGE)
46 | nine.grid(row=1,sticky="w",padx=15)
47 |
48 | eight = Button(text="8",width=2,command=lambda:inp.insert("end","8"),borderwidth=3,relief=RIDGE)
49 | eight.grid(row=1,sticky="w",padx=45)
50 |
51 | seven = Button(root,text="7",width=2,command=lambda:inp.insert("end","7"),borderwidth=3,relief=RIDGE)
52 | seven.grid(row=1,sticky="w",padx=75)
53 |
54 | plus = Button(root,text="+",width=2,command=lambda:inp.insert("end","+"),borderwidth=3,relief=RIDGE)
55 | plus.grid(row=1,sticky="e",padx=125)
56 |
57 |
58 | six = Button(text="6",width=2,command=lambda:inp.insert("end","6"),borderwidth=3,relief=RIDGE)
59 | six.grid(row=2,sticky="w",padx=15,pady=5)
60 |
61 | five = Button(text="5",width=2,command=lambda:inp.insert("end","5"),borderwidth=3,relief=RIDGE)
62 | five.grid(row=2,sticky="w",padx=45,pady=5)
63 |
64 | four = Button(root,text="4",width=2,command=lambda:inp.insert("end","4"),borderwidth=3,relief=RIDGE)
65 | four.grid(row=2,sticky="w",padx=75,pady=5)
66 |
67 | minus = Button(root,text="-",width=2,command=lambda:inp.insert("end","-"),borderwidth=3,relief=RIDGE)
68 | minus.grid(row=2,sticky="e",padx=125,pady=5)
69 |
70 |
71 |
72 | three = Button(text="3",width=2,command=lambda:inp.insert("end","3"),borderwidth=3,relief=RIDGE)
73 | three.grid(row=3,sticky="w",padx=15,pady=5)
74 |
75 | two = Button(text="2",width=2,command=lambda:inp.insert("end","2"),borderwidth=3,relief=RIDGE)
76 | two.grid(row=3,sticky="w",padx=45,pady=5)
77 |
78 | one = Button(root,text="1",width=2,command=lambda:inp.insert("end","1"),borderwidth=3,relief=RIDGE)
79 | one.grid(row=3,sticky="w",padx=75,pady=5)
80 |
81 | multiply = Button(root,text="*",width=2,command=lambda:inp.insert("end","*"),borderwidth=3,relief=RIDGE)
82 | multiply.grid(row=3,sticky="e",padx=125,pady=5)
83 |
84 |
85 | zero = Button(text="0",width=2,command=lambda:inp.insert("end","0"),borderwidth=3,relief=RIDGE)
86 | zero.grid(row=4,sticky="w",padx=15,pady=5)
87 |
88 | double_zero = Button(text="00",width=2,command=lambda:inp.insert("end","00"),borderwidth=3,relief=RIDGE)
89 | double_zero.grid(row=4,sticky="w",padx=45,pady=5)
90 |
91 | dot = Button(root,text=".",width=2,command=lambda:inp.insert("end","."),borderwidth=3,relief=RIDGE)
92 | dot.grid(row=4,sticky="w",padx=75,pady=5)
93 |
94 | divide = Button(root,text="/",width=2,command=lambda:inp.insert("end","/"),borderwidth=3,relief=RIDGE)
95 | divide.grid(row=4,sticky="e",padx=125,pady=5)
96 |
97 | result = Button(root,text="=",width=10,command=result,bg="red",fg="white",borderwidth=3,relief=RIDGE)
98 | result.grid(row=5,sticky="w",padx=15,pady=5)
99 |
100 | modulus = Button(root,text="%",width=2,command=lambda:inp.insert("end","%"),borderwidth=3,relief=RIDGE)
101 | modulus.grid(row=5,sticky="e",padx=125,pady=5)
102 |
103 | root.mainloop()
104 |
105 | # <============ end code ==============>
106 |
--------------------------------------------------------------------------------
/Google Engine/google-search-engine.py:
--------------------------------------------------------------------------------
1 | # =============== Importing Suitable Libraries ==========================
2 | from tkinter import *
3 | import tkinter as tk
4 | import webbrowser
5 | from PIL import ImageTk, Image
6 | import googlesearch
7 | # ================== .............. End..........============================
8 |
9 | # ================== .......... Window Components........ ===================
10 |
11 | #creating main window
12 | root = tk.Tk()
13 | #title of window
14 | root.title("Google Search Engine")
15 | #window size
16 | root.geometry("800x500")
17 | #window max-size
18 | root.maxsize(800,500)
19 | #window min-size
20 | root.minsize(800,500)
21 | #window icon
22 | root.iconbitmap('Google.ico')
23 |
24 | # ========================== ............. End............ =====================
25 |
26 | # ============================== Action Function Code Starts here ====================
27 | def callback(url):
28 | webbrowser.open(url)
29 |
30 | def search_query():
31 |
32 | query = text.get("1.0","end-1c")
33 | s = googlesearch.search(query, tld="co.in", num=10, stop=1, pause=2)
34 | for j in s:
35 | print(webbrowser.open(j))
36 |
37 |
38 |
39 |
40 | #============================== .............. End ................. ===================
41 |
42 |
43 | # ======================== Main Design Window ===============================
44 |
45 | #label to create top design
46 | l1 = Label(root,bg="black",width=500,height=2)
47 | l1.grid(sticky="w")
48 |
49 | #apps logo
50 | apps_logo = ImageTk.PhotoImage(Image.open('apps.jpg'))
51 | d = Label(root, image = apps_logo,borderwidth=0)
52 | d.place(x=15,y=11)
53 | #apps label
54 | apps = Label(root,text="Apps",bg="black",fg="white",cursor="hand2")
55 | apps.place(x=40,y=10)
56 | apps.bind("",lambda e: callback("https://about.google/intl/en/products/?tab=wh"))
57 |
58 |
59 |
60 | # drive logo
61 | d_logo = ImageTk.PhotoImage(Image.open('Google drive.png'))
62 | d = Label(root, image = d_logo,borderwidth=0)
63 | d.place(x=95,y=11)
64 | # drive label
65 | drive = Label(root,text="Google Drive",bg="black",fg="white",cursor="hand2")
66 | drive.place(x=120,y=10)
67 | drive.bind("",lambda e: callback("https://drive.google.com/"))
68 |
69 |
70 | #youtube logo
71 | yt_logo = ImageTk.PhotoImage(Image.open('youtube.png'))
72 | y = Label(root, image = yt_logo,borderwidth=0)
73 | y.place(x=210,y=12)
74 | #youtube label
75 | yt = Label(root,text="YouTube",bg="black",fg="white",cursor="hand2")
76 | yt.place(x=240,y=10)
77 | yt.bind("",lambda e: callback("https://www.youtube.com/"))
78 |
79 |
80 | #Gmail logo
81 | gm_logo = ImageTk.PhotoImage(Image.open('gmail.jpg'))
82 | l2 = Label(root, image = gm_logo,borderwidth=0)
83 | l2.place(x=310,y=12)
84 |
85 | #Gmail label
86 | gmail = Label(root,text="Gmail",bg="black",fg="white",cursor="hand2")
87 | gmail.place(x=340,y=10)
88 | gmail.bind("",lambda e: callback("https://mail.google.com/mail/"))
89 |
90 |
91 | #Gmail label
92 | g = Label(root,text="Gmail",cursor="hand2")
93 | g.place(x=630,y=50)
94 | g.bind("",lambda e: callback("https://mail.google.com/mail/"))
95 |
96 | #Images label
97 | i = Label(root,text="Images",cursor="hand2")
98 | i.place(x=670,y=50)
99 | i.bind("",lambda e: callback("https://www.google.co.in/imghp?hl=en&tab=wi&ogbl"))
100 |
101 | #signin button
102 | signin = Button(root,text="sign in",font=('roboto',10,'bold'),bg="#4583EC",fg="white",cursor="hand2")
103 | signin.place(x=730,y=50)
104 | signin.bind("",lambda e: callback("http://google.com"))
105 |
106 |
107 | #google logo
108 | g_logo = ImageTk.PhotoImage(Image.open('google logo.png'))
109 | l2 = Label(root, image = g_logo)
110 | l2.place(x=260,y=190)
111 |
112 |
113 | #search box
114 | text = Text(root,width=90,height=2,relief=RIDGE,font=('roboto',10,'bold'),borderwidth=2)
115 | text.place(x=120,y=300)
116 |
117 | #search button
118 | search = Button(root, text="Google Search",relief=RIDGE,font=('arial',10),bg="#F3F3F3",fg="#222222",cursor="hand2",command=search_query)
119 | search.place(x=280,y=360)
120 |
121 |
122 | #Lucky Button
123 | lucky = Button(root, text="i' m Felling Lucky",relief=RIDGE,font=('arial',10),bg="#F3F3F3",fg="#222222",cursor="hand2")
124 | lucky.place(x=400,y=360)
125 | apps.bind("",lambda e: callback("http://google.com"))
126 |
127 |
128 | #offered label
129 | offered = Label(root,text="Google offered in:")
130 | offered.place(x=120,y=410)
131 | lang = Label(root,text="हिन्दी বাংলা తెలుగు मराठी தமிழ் ગુજરાતી ಕನ್ನಡ മലയാളം ਪੰਜਾਬੀ",fg="blue")
132 | lang.place(x=230,y=410)
133 |
134 | #===================== Load the Window =============================
135 | root.mainloop()
136 |
137 | #======================= End Code =====================================
138 |
--------------------------------------------------------------------------------
/Calculator with Images/calculator_with_images.py:
--------------------------------------------------------------------------------
1 | # Image resources are provided in the file
2 | # Make sure you change the paths in the code
3 |
4 | from tkinter import *
5 | from PIL import ImageTk , Image
6 |
7 | rt = Tk()
8 | rt.title("Basic Calculator")
9 | #Change path of ico file here
10 | rt.iconbitmap('C:/imgs/icons/calc512px.ico') #CHANGE PATH INSIDE ''
11 | rt.geometry("300x430")
12 | #change path of Background file here
13 | bg = ImageTk.PhotoImage(file="C:/imgs/300x430_bg.png") #CHANGE PATH INSIDE " "
14 | bg_label = Label(rt, image=bg).place(x=0,y=0)
15 |
16 | # Entry Widget
17 |
18 | e = Entry(rt,width=35,borderwidth=10,font=("Times",10))
19 | e.grid(row=0,column=0,pady=20,padx=30,columnspan=3)
20 |
21 | # CHANGE YOUR PATHS HERE..!!!!!
22 | # Example Img1 = ImageTk.PhotoImage(file="YOUR PATH HERE")
23 |
24 | Img1 = ImageTk.PhotoImage(file="C:/Users/irfan/OneDrive/Desktop/MO TECH/pngs50x50/1.png")
25 | Img2 = ImageTk.PhotoImage(file="C:/Users/irfan/OneDrive/Desktop/MO TECH/pngs50x50/2.png")
26 | Img3 = ImageTk.PhotoImage(file="C:/Users/irfan/OneDrive/Desktop/MO TECH/pngs50x50/3.png")
27 | Img4 = ImageTk.PhotoImage(file="C:/Users/irfan/OneDrive/Desktop/MO TECH/pngs50x50/4.png")
28 | Img5 = ImageTk.PhotoImage(file="C:/Users/irfan/OneDrive/Desktop/MO TECH/pngs50x50/5.png")
29 | Img6 = ImageTk.PhotoImage(file="C:/Users/irfan/OneDrive/Desktop/MO TECH/pngs50x50/6.png")
30 | Img7 = ImageTk.PhotoImage(file="C:/Users/irfan/OneDrive/Desktop/MO TECH/pngs50x50/7.png")
31 | Img8 = ImageTk.PhotoImage(file="C:/Users/irfan/OneDrive/Desktop/MO TECH/pngs50x50/8.png")
32 | Img9 = ImageTk.PhotoImage(file="C:/Users/irfan/OneDrive/Desktop/MO TECH/pngs50x50/9.png")
33 | Img0 = ImageTk.PhotoImage(file="C:/Users/irfan/OneDrive/Desktop/MO TECH/pngs50x50/10.png")
34 | ImgA = ImageTk.PhotoImage(file="C:/Users/irfan/OneDrive/Desktop/MO TECH/pngs50x50/11.png")
35 | ImgS = ImageTk.PhotoImage(file="C:/Users/irfan/OneDrive/Desktop/MO TECH/pngs50x50/12.png")
36 | ImgM = ImageTk.PhotoImage(file="C:/Users/irfan/OneDrive/Desktop/MO TECH/pngs50x50/13.png")
37 | ImgD = ImageTk.PhotoImage(file="C:/Users/irfan/OneDrive/Desktop/MO TECH/pngs50x50/14.png")
38 | ImgE = ImageTk.PhotoImage(file="C:/Users/irfan/OneDrive/Desktop/MO TECH/pngs50x50/15.png")
39 | ImgCLR = ImageTk.PhotoImage(file="C:/Users/irfan/OneDrive/Desktop/MO TECH/pngs50x50/16.png")
40 |
41 |
42 |
43 | def button_click(number):
44 | current = e.get()
45 | e.delete(0, END)
46 | e.insert(0, str(current) + str(number))
47 |
48 |
49 | def button_add():
50 | first_number = e.get()
51 | global f_num
52 | global maths
53 | maths = "addition"
54 | f_num = int(first_number)
55 | e.delete(0, END)
56 |
57 |
58 | def button_sub():
59 | first_number = e.get()
60 | global f_num
61 | global maths
62 | maths = "subtraction"
63 | f_num = int(first_number)
64 | e.delete(0, END)
65 |
66 | def button_div():
67 | first_number = e.get()
68 | global f_num
69 | global maths
70 | maths = "division"
71 | f_num = int(first_number)
72 | e.delete(0, END)
73 |
74 | def button_mult():
75 | first_number = e.get()
76 | global f_num
77 | global maths
78 | maths = "multiplication"
79 | f_num = int(first_number)
80 | e.delete(0, END)
81 |
82 | def button_equals():
83 | second_number = e.get()
84 | e.delete(0, END)
85 |
86 | if maths == "addition":
87 | e.insert(0, f_num+int(second_number))
88 | if maths == "subtraction":
89 | e.insert(0, f_num-int(second_number))
90 | if maths == "multiplication":
91 | e.insert(0, f_num*int(second_number))
92 | if maths == "division":
93 | e.insert(0, f_num/int(second_number))
94 |
95 |
96 | def button_clear():
97 | e.delete(0,END)
98 |
99 | # Defining Buttons
100 | button1 = Button(rt,border="3",image=Img1,command= lambda:button_click(1)).grid(row= 1,column=0)
101 | button2 = Button(rt,border="3",image=Img2,command= lambda:button_click(2)).grid(row= 1,column=1)
102 | button3 = Button(rt,border="3",image=Img3,command= lambda:button_click(3)).grid(row= 1,column=2)
103 | button4 = Button(rt,border="3",image=Img4,command= lambda:button_click(4)).grid(row= 2,column=0)
104 | button5 = Button(rt,border="3",image=Img5,command= lambda:button_click(5)).grid(row= 2,column=1)
105 | button6 = Button(rt,border="3",image=Img6,command= lambda:button_click(6)).grid(row= 2,column=2)
106 | button7 = Button(rt,border="3",image=Img7,command= lambda:button_click(7)).grid(row= 3,column=0)
107 | button8 = Button(rt,border="3",image=Img8,command= lambda:button_click(8)).grid(row= 3,column=1)
108 | button9 = Button(rt,border="3",image=Img9,command= lambda:button_click(9)).grid(row= 3,column=2)
109 | button0 = Button(rt,border="3",image=Img0,command= lambda:button_click(0)).grid(row= 4,column=1)
110 | buttonA = Button(rt,border="3",image=ImgA,command= button_add).grid(row= 4,column=2)
111 | buttonS = Button(rt,border="3",image=ImgS,command= button_sub).grid(row= 4,column=0)
112 | buttonM = Button(rt,border="3",image=ImgM,command= button_mult).grid(row= 5,column=1)
113 | buttonD = Button(rt,border="3",image=ImgD,command= button_div).grid(row= 5,column=0)
114 | buttonE = Button(rt,border="3",image=ImgE,command= button_equals).grid(row= 5,column=2)
115 | buttonCLR=Button(rt,border="3",image=ImgCLR,command=button_clear).grid(row= 6,column=1)
116 |
117 | rt.mainloop()
118 |
--------------------------------------------------------------------------------
/Email Sender/send_email.py:
--------------------------------------------------------------------------------
1 | from tkinter import *
2 | from tkinter import ttk
3 | import tkinter as tk
4 | from PIL import ImageTk, Image
5 | from tkinter import messagebox
6 | import smtplib
7 | from tkinter.scrolledtext import ScrolledText
8 |
9 | root = tk.Tk()
10 |
11 | # Custom styles for hover effects
12 | style = ttk.Style()
13 | style.theme_use('clam') # You can choose a different theme if needed
14 |
15 | style.map("C.TButton",
16 | foreground=[('pressed', 'black'), ('active', 'blue')],
17 | background=[('pressed', '!disabled', 'gray'), ('active', 'white')]
18 | )
19 |
20 | style.map("L.TButton",
21 | foreground=[('pressed', 'black'), ('active', 'blue')],
22 | background=[('pressed', '!disabled', 'gray'), ('active', 'orange')]
23 | )
24 |
25 | def on_enter(event):
26 | event.widget.config(bg="orange")
27 |
28 | def on_leave(event):
29 | event.widget.config(bg="white")
30 |
31 | def Login():
32 | e = email.get()
33 | p = password.get()
34 |
35 | if '@gmail.com' not in e or e == "":
36 | messagebox.showerror('Login error',"Please write a valid email")
37 | elif p == "":
38 | messagebox.showerror('Login error',"Password shouldn't be empty")
39 | else:
40 | try:
41 | s = smtplib.SMTP('smtp.gmail.com', 587)
42 | s.starttls()
43 | s.login(e,p)
44 | messagebox.showinfo("Login Success","You have logged into Gmail successfully")
45 | root.withdraw() # Hide login window
46 |
47 | # Create the main window
48 | main_window = tk.Toplevel()
49 | main_window.geometry('500x400')
50 | main_window.title('Email Sender')
51 |
52 | def Logout():
53 | s.quit()
54 | main_window.destroy()
55 |
56 | header1 = Label(main_window, bg="orange", width=300, height=2)
57 | header1.place(x=0, y=0)
58 |
59 | h2 = Label(main_window, text="Email Sender", bg="orange", fg="black", font=('verdana', 13, 'bold'))
60 | h2.place(x=175, y=5)
61 |
62 | logout = ttk.Button(main_window, text="Logout", style="C.TButton", width=10, command=Logout)
63 | logout.place(x=390, y=38)
64 |
65 | r = Label(main_window, text="Recipient Email Address", font=('verdana', 10, 'bold'))
66 | r.place(x=130, y=130)
67 | recipient = Entry(main_window, width=30, relief=RIDGE, borderwidth=3)
68 | recipient.place(x=130, y=150)
69 |
70 | st = Label(main_window, text="Subject", font=('verdana', 10, 'bold'))
71 | st.place(x=130, y=190)
72 | subject = Entry(main_window, width=30, relief=RIDGE, borderwidth=3)
73 | subject.place(x=130, y=210)
74 |
75 | m = Label(main_window, text="Message", font=('verdana', 10, 'bold'))
76 | m.place(x=130, y=250)
77 |
78 | message = ScrolledText(main_window, width=40, height=5, relief=RIDGE, borderwidth=3)
79 | message.place(x=130, y=270)
80 |
81 | def Send():
82 | r = recipient.get()
83 | st = subject.get()
84 | m = message.get('1.0', END)
85 |
86 | if '@gmail.com' not in r or r == "":
87 | messagebox.showerror('Sending Mail error', "Please write a valid email")
88 | elif m == "":
89 | messagebox.showerror('Sending Mail error', "Message shouldn't be empty")
90 | else:
91 | s.sendmail(r, e, f'Subject :{st}\n\n {m}')
92 | messagebox.showinfo("Success", "Your message has been sent successfully")
93 |
94 | send = ttk.Button(main_window, text="Send", style="C.TButton", width=10, command=Send)
95 | send.place(x=350, y=360)
96 |
97 | main_window.mainloop()
98 |
99 | except:
100 | messagebox.showerror('Login error', "Failed to login. Check your email or password.")
101 |
102 | root.title('Email Sender')
103 | root.geometry('400x300')
104 | root.maxsize(400,300)
105 | root.minsize(400,300)
106 |
107 | header = Label(root, bg="orange", width=300, height=2)
108 | header.place(x=0, y=0)
109 |
110 | h1 = Label(root, text="Email Sender", bg="orange", fg="black", font=('verdana', 13, 'bold'))
111 | h1.place(x=135, y=5)
112 |
113 | img = ImageTk.PhotoImage(Image.open('gmail.png'))
114 |
115 | logo = Label(root, image=img, borderwidth=0)
116 | logo.place(x=150, y=38)
117 |
118 | e = Label(root, text="Email Address", font=('verdana', 10, 'bold'))
119 | e.place(x=100, y=130)
120 | email = Entry(root, width=30, relief=RIDGE, borderwidth=3, font=('Arial', 10)) # Changed font here
121 | email.place(x=100, y=150)
122 | email.bind("", on_enter)
123 | email.bind("", on_leave)
124 |
125 | p = Label(root, text="Password", font=('verdana', 10, 'bold'))
126 | p.place(x=100, y=190)
127 | password = Entry(root, width=30, relief=RIDGE, borderwidth=3, font=('Arial', 10)) # Changed font here
128 | password.place(x=100, y=210)
129 | password.bind("", on_enter)
130 | password.bind("", on_leave)
131 |
132 | login = ttk.Button(root, text="Login", style="L.TButton", width=10, command=Login) # Changed style here
133 | login.place(x=145, y=240)
134 |
135 | root.mainloop()
136 |
--------------------------------------------------------------------------------
/Instant News Headlines (Tkinter + NewsApi)/main.py:
--------------------------------------------------------------------------------
1 |
2 | #tkinter module
3 | from tkinter import *
4 |
5 | #image module
6 | from PIL import Image, ImageTk
7 |
8 | #font from tkinter
9 | from tkinter import font
10 |
11 | #requests module
12 | import requests
13 |
14 | #random module
15 | import random
16 |
17 | #main welcome window code
18 | welcome = Tk()
19 | welcome.title("Sami News ")
20 | welcome.geometry('500x500')
21 |
22 | background = Image.open('—Pngtree—vector creative hot news tag_4265321.png')
23 | resized_image = background.resize((500, 500), Image.ANTIALIAS)
24 |
25 |
26 | #function to open second window
27 | def openSecondWindow():
28 | selected_optioncountry = ""
29 | selected_optioncategory=""
30 | secondwindow = Toplevel()
31 | secondwindow.title("Select Your Headlines Types")
32 | secondwindow.geometry("1000x400")
33 | bold_font = font.Font(family="Helvetica", size=12, weight="bold")
34 | langlabel=Label(secondwindow,text="Select Country---US for United States of America",font=bold_font)
35 | langlabel.pack()
36 |
37 | #saving options select from toggle menu
38 | def save_option():
39 | nonlocal selected_optioncountry
40 | selected_optioncountry= (var.get())[:2]
41 |
42 | #saving options from toggle menu
43 | def save_option2():
44 | nonlocal selected_optioncategory
45 | selected_optioncategory= var2.get()
46 |
47 |
48 | #get news api from newsapi
49 | def getnews():
50 | api_key = "a8ab6d9bd5684d27bab671e76c15eb91"
51 | country = selected_optioncountry
52 | cat= selected_optioncategory
53 | url = f"https://newsapi.org/v2/top-headlines?country={country}&category={cat}&apiKey="+api_key
54 | news = requests.get(url).json()
55 | articles = news["articles"]
56 | my_articles = []
57 | my_news = ""
58 |
59 | for article in articles:
60 | my_articles.append(article["title"])
61 |
62 | for i in range(10):
63 | my_news += f"{i + 1}. {my_articles[i]}\n"
64 |
65 | button_gethealines.config(text=my_news)
66 | #toggle menu code 1
67 | var = (StringVar())
68 | var.set("US-United States of America")
69 | options = ["GB-Great Britian", "AU-Australia", "FR-France","DE-Germany","RU-Russia","TR-turkey","UA-Ukraine"]
70 | drop_down = OptionMenu(secondwindow, var, *options)
71 | drop_down.pack()
72 | save_button = Button(secondwindow, text="Save Country", command=save_option,width=10,height=1,bg="red",fg="white")
73 | save_button.place(x=100,y=20)
74 | save_button.pack()
75 | bold_font = font.Font(family="Helvetica", size=12, weight="bold")
76 | categorylabel=Label(secondwindow,text="Select Category of News",font=bold_font)
77 | categorylabel.pack()
78 |
79 | #toggle menu code 2
80 | var2 = (StringVar())
81 | var2.set("business")
82 | options = ["sports", "health", "science","technology","general"]
83 | drop_down2 = OptionMenu(secondwindow, var2, *options)
84 | drop_down2.pack()
85 | save_button2 = Button(secondwindow, text="Save Category", command=save_option2,width=10,height=1,bg="red",fg="white")
86 | save_button2.pack()
87 | button_gethealines = Button(secondwindow, text="Fetch News",command=getnews)
88 | button_gethealines.pack()
89 |
90 |
91 | secondwindow.mainloop()
92 |
93 |
94 |
95 | #second window of random news generator
96 | def randomwindow():
97 | randomwindowtab=Toplevel()
98 | randomwindowtab.title("Random News")
99 | randomwindowtab.geometry("300x300")
100 |
101 | #get random news by random number generator and countries/categories generated from list
102 | def randomnews():
103 | api_key = "a8ab6d9bd5684d27bab671e76c15eb91"
104 | countries = ['uS','gb', 'au', 'fr', 'de', 'ru', 'tr', 'ua']
105 | categories = ['science', 'health', 'sports', 'technology', 'general']
106 | cot = random.randint(0, 7)
107 | cat = random.randint(0, 4)
108 |
109 | url = f"https://newsapi.org/v2/top-headlines?country={(countries[cot])}&category={(categories[cat])}&apiKey=" + api_key
110 | news = requests.get(url).json()
111 | articles = news["articles"]
112 | my_articles = []
113 | my_news = ""
114 |
115 | for article in articles:
116 | my_articles.append(article["title"])
117 | for i in range(10):
118 | my_news += f"{i + 1}. {my_articles[i]}\n"
119 | b3.config(text=my_news)
120 |
121 |
122 | #button in this window
123 | b3 = Button(randomwindowtab,command=randomnews,text="Get Random News Now",activeforeground="red", pady=10, width=20, height=1)
124 | b3.pack()
125 | randomwindowtab.mainloop()
126 |
127 | #background image
128 | tk_image = ImageTk.PhotoImage(resized_image)
129 | label = Label(welcome, image=tk_image)
130 | label.place(x=0, y=0, relwidth=1, relheight=1)
131 | #button 1
132 | b1 = Button(welcome, command=openSecondWindow, text="Get News Headlines Of Your Choice", activeforeground="red", pady=10, width=30, height=1)
133 | b1.place(x=100,y=90)
134 | #button 2
135 | b2 = Button(welcome, command=randomwindow,text="Get Top10 Random News", activeforeground="red", pady=10, width=20, height=1)
136 | b2.pack(side=BOTTOM)
137 | b1.pack(side=BOTTOM)
138 | bold_font = font.Font(family="Helvetica", size=12, weight="bold")
139 | Welcometext = Label(welcome, text="Get Top Headlines Through News Api", font=bold_font)
140 | Welcometext.pack()
141 |
142 |
143 | welcome.mainloop()
144 |
145 |
146 |
147 |
--------------------------------------------------------------------------------
/weather application/weather.py:
--------------------------------------------------------------------------------
1 | from tkinter import *
2 | import tkinter as tk
3 | from datetime import datetime
4 | from PIL import ImageTk , Image
5 | import requests
6 | from tkinter import messagebox
7 |
8 | class Weather():
9 |
10 |
11 | def weather_report(self):
12 |
13 | self.url = "http://api.openweathermap.org/data/2.5/weather?q="
14 | self.cityname = self.loc.get(1.0,END)
15 | self.api_key = 'paste your api key here'
16 | self.data = requests.get(self.url+self.cityname+'&appid='+self.api_key).json()
17 |
18 |
19 | if self.data['cod'] == '404':
20 | messagebox.showerror('Error','City Not Found !!')
21 | else:
22 | self.location['text'] = self.data['name'] + "," + self.data['sys']['country']
23 | self.c = int(self.data['main']['temp_max'] - 273.15)
24 | self.f = self.c*9/5+32
25 | self.weather['text'] = self.data['weather'][0]['main']
26 | self.weather['font'] = ('verdana',20,'bold')
27 | self.temperature['text'] = f'{self.c}°C \n {self.f}°F'
28 | self.temperature['font'] = ('verdana',15,'bold')
29 | self.humidity['text'] = self.data['main']['humidity']
30 | self.humidity['font'] = ('verdana',15,'bold')
31 | self.pressure['text'] = self.data['main']['pressure']
32 | self.pressure['font'] = ('verdana',15,'bold')
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 | def __init__(self):
47 | self.root = tk.Tk()
48 | self.root.geometry('500x300')
49 | self.root.title("Weather Application")
50 | self.root.maxsize(500,300)
51 | self.root.minsize(500,300)
52 |
53 | self.header = Label(self.root,width=100,height=2,bg="#00274c")
54 | self.header.place(x=0,y=0)
55 |
56 | self.font = ('verdana',10,'bold')
57 |
58 | self.date = Label(self.root,text=datetime.now().date(),bg="#00274c",fg="white",font=self.font)
59 | self.date.place(x=400,y=5)
60 |
61 | self.heading = Label(self.root,text="Weather Report",bg="#00274c",fg="white",font=self.font)
62 | self.heading.place(x=180,y=5)
63 |
64 |
65 | self.location = Label(self.root,text="NA-/",bg="#00274c",fg="white",font=self.font)
66 | self.location.place(x=10,y=5)
67 |
68 | self.img = ImageTk.PhotoImage(Image.open('icon.png'))
69 | self.image = Label(self.root,image=self.img)
70 | self.image.place(x=20,y=40)
71 |
72 | self.name = Label(self.root,text="City or Country Name",fg="#00274c",font=self.font)
73 | self.name.place(x=140,y=45)
74 |
75 | self.loc = Text(self.root,width=25,height=2)
76 | self.loc.place(x=140,y=70)
77 |
78 | self.button = Button(self.root,text="Search",bg="#00274c",fg="white",font=self.font,relief=RAISED,borderwidth=3,command=self.weather_report)
79 | self.button.place(x=350,y=73)
80 |
81 | self.line1 = Label(self.root,bg="#00274c",width=20,height=0)
82 | self.line1.place(x=0,y=150)
83 | self.line2 = Label(self.root,bg="#00274c",width=20,height=0)
84 | self.line2.place(x=360,y=150)
85 |
86 | self.report = Label(self.root,text="Weather Report",bg="#00274c",fg="white",font=self.font,padx=10)
87 | self.report.place(x=180,y=150)
88 |
89 |
90 | self.img2 = ImageTk.PhotoImage(Image.open('icon2.png'))
91 | self.image2 = Label(self.root,image=self.img2)
92 | self.image2.place(x=90,y=180)
93 | self.weather = Label(self.root,text="NA/-",fg="#00274c",font=self.font)
94 | self.weather.place(x=90,y=230)
95 |
96 |
97 | self.img3 = ImageTk.PhotoImage(Image.open('icon3.png'))
98 | self.image3 = Label(self.root,image=self.img3)
99 | self.image3.place(x=200,y=180)
100 | self.temperature = Label(self.root,text="NA/-",fg="#00274c",font=self.font)
101 | self.temperature.place(x=200,y=230)
102 |
103 |
104 | self.img4 = ImageTk.PhotoImage(Image.open('icon4.png'))
105 | self.image4 = Label(self.root,image=self.img4)
106 | self.image4.place(x=310,y=180)
107 | self.humidity = Label(self.root,text="NA/-",fg="#00274c",font=self.font)
108 | self.humidity.place(x=310,y=230)
109 |
110 |
111 | self.img5 = ImageTk.PhotoImage(Image.open('icon5.png'))
112 | self.image5 = Label(self.root,image=self.img5)
113 | self.image5.place(x=380,y=180)
114 | self.pressure = Label(self.root,text="NA/-",fg="#00274c",font=self.font)
115 | self.pressure.place(x=380,y=230)
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 | self.root.mainloop()
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 | if __name__ == '__main__':
136 |
137 | Weather()
138 |
139 |
140 |
--------------------------------------------------------------------------------
/Translator/translator.py:
--------------------------------------------------------------------------------
1 | from tkinter import *
2 | import tkinter as tk
3 | from tkinter import ttk
4 | from PIL import ImageTk, Image #pip install pillow
5 | from googletrans import Translator #pip install googletrans==3.1.0a0
6 | from tkinter import messagebox
7 |
8 | root = tk.Tk()
9 | root.title('Langauge Translator')
10 | root.geometry('530x330')
11 | root.maxsize(530,330)
12 | root.minsize(530,330)
13 |
14 |
15 | def translate():
16 | language_1 = t1.get("1.0","end-1c")
17 | cl = choose_langauge.get()
18 |
19 | if language_1 == '':
20 | messagebox.showerror('Language Translator','please fill the box')
21 | else:
22 | t2.delete(1.0,'end')
23 | translator = Translator()
24 | output = translator.translate(language_1, dest=cl)
25 | t2.insert('end',output.text)
26 |
27 | def clear():
28 | t1.delete(1.0,'end')
29 | t2.delete(1.0,'end')
30 |
31 |
32 |
33 |
34 | img = ImageTk.PhotoImage(Image.open('translator.png'))
35 | label = Label(image=img)
36 | label.place(x=230,y=3)
37 |
38 |
39 | a = tk.StringVar()
40 | auto_detect = ttk.Combobox(root, width = 20, textvariable = a, state='readonly',font=('verdana',10,'bold'),)
41 |
42 |
43 |
44 | auto_detect['values'] = (
45 | 'Auto Detect',
46 | )
47 |
48 | auto_detect.place(x=30,y=70)
49 | auto_detect.current(0)
50 |
51 |
52 |
53 |
54 |
55 | l = tk.StringVar()
56 | choose_langauge = ttk.Combobox(root, width = 20, textvariable = l, state='readonly',font=('verdana',10,'bold'))
57 |
58 |
59 |
60 | choose_langauge['values'] = (
61 | 'Afrikaans',
62 | 'Albanian',
63 | 'Arabic',
64 | 'Armenian',
65 | ' Azerbaijani',
66 | 'Basque',
67 | 'Belarusian',
68 | 'Bengali',
69 | 'Bosnian',
70 | 'Bulgarian',
71 | ' Catalan',
72 | 'Cebuano',
73 | 'Chichewa',
74 | 'Chinese',
75 | 'Corsican',
76 | 'Croatian',
77 | ' Czech',
78 | 'Danish',
79 | 'Dutch',
80 | 'English',
81 | 'Esperanto',
82 | 'Estonian',
83 | 'Filipino',
84 | 'Finnish',
85 | 'French',
86 | 'Frisian',
87 | 'Galician',
88 | 'Georgian',
89 | 'German',
90 | 'Greek',
91 | 'Gujarati',
92 | 'Haitian Creole',
93 | 'Hausa',
94 | 'Hawaiian',
95 | 'Hebrew',
96 | 'Hindi',
97 | 'Hmong',
98 | 'Hungarian',
99 | 'Icelandic',
100 | 'Igbo',
101 | 'Indonesian',
102 | 'Irish',
103 | 'Italian',
104 | 'Japanese',
105 | 'Javanese',
106 | 'Kannada',
107 | 'Kazakh',
108 | 'Khmer',
109 | 'Kinyarwanda',
110 | 'Korean',
111 | 'Kurdish',
112 | 'Kyrgyz',
113 | 'Lao',
114 | 'Latin',
115 | 'Latvian',
116 | 'Lithuanian',
117 | 'Luxembourgish',
118 | 'Macedonian',
119 | 'Malagasy',
120 | 'Malay',
121 | 'Malayalam',
122 | 'Maltese',
123 | 'Maori',
124 | 'Marathi',
125 | 'Mongolian',
126 | 'Myanmar',
127 | 'Nepali',
128 | 'Norwegian'
129 | 'Odia',
130 | 'Pashto',
131 | 'Persian',
132 | 'Polish',
133 | 'Portuguese',
134 | 'Punjabi',
135 | 'Romanian',
136 | 'Russian',
137 | 'Samoan',
138 | 'Scots Gaelic',
139 | 'Serbian',
140 | 'Sesotho',
141 | 'Shona',
142 | 'Sindhi',
143 | 'Sinhala',
144 | 'Slovak',
145 | 'Slovenian',
146 | 'Somali',
147 | 'Spanish',
148 | 'Sundanese',
149 | 'Swahili',
150 | 'Swedish',
151 | 'Tajik',
152 | 'Tamil',
153 | 'Tatar',
154 | 'Telugu',
155 | 'Thai',
156 | 'Turkish',
157 | 'Turkmen',
158 | 'Ukrainian',
159 | 'Urdu',
160 | 'Uyghur',
161 | 'Uzbek',
162 | 'Vietnamese',
163 | 'Welsh',
164 | 'Xhosa'
165 | 'Yiddish',
166 | 'Yoruba',
167 | 'Zulu',
168 | )
169 |
170 | choose_langauge.place(x=290,y=70)
171 | choose_langauge.current(0)
172 |
173 |
174 | t1 = Text(root,width=30,height=10,borderwidth=5,relief=RIDGE)
175 | t1.place(x=10,y=100)
176 |
177 | t2 = Text(root,width=30,height=10,borderwidth=5,relief=RIDGE)
178 | t2.place(x=260,y=100)
179 |
180 |
181 | button = Button(root,text="Translate",relief=RIDGE,borderwidth=3,font=('verdana',10,'bold'),cursor="hand2",command=translate)
182 | button.place(x=150,y=280)
183 |
184 |
185 | clear = Button(root,text="Clear",relief=RIDGE,borderwidth=3,font=('verdana',10,'bold'),cursor="hand2",command=clear)
186 | clear.place(x=280,y=280)
187 |
188 | root.mainloop()
189 |
--------------------------------------------------------------------------------
/currency/currency-converter.py:
--------------------------------------------------------------------------------
1 | import tkinter as tk
2 | from tkinter import *
3 | from tkinter import ttk
4 | from datetime import datetime
5 | import requests
6 | from PIL import ImageTk, Image
7 | from tkinter import messagebox
8 | root = tk.Tk()
9 | root.geometry("600x270")
10 | root.title("Currency Converter")
11 | root.iconbitmap('icon.ico')
12 | root.maxsize(600,270)
13 | root.minsize(600,270)
14 |
15 |
16 | image = Image.open('currency.png')
17 | zoom = 0.5
18 |
19 | #multiple image size by zoom
20 | pixels_x, pixels_y = tuple([int(zoom * x) for x in image.size])
21 |
22 | img = ImageTk.PhotoImage(image.resize((pixels_x, pixels_y)))
23 | panel = Label(root, image = img)
24 | panel.place(x=190,y=35)
25 |
26 | def show_data():
27 | amount = E1.get()
28 | from_currency = c1.get()
29 | to_currency = c2.get()
30 | url = 'http://api.currencylayer.com/live?access_key=4273d2c37f738367f08780b934ce7dda&format=1'
31 |
32 | if amount == '':
33 | messagebox.showerror("Currency Converter", "Please Fill the Amount")
34 | elif to_currency == '':
35 | messagebox.showerror("Currency Converter", "Please Choose the Currency")
36 |
37 | else:
38 | data = requests.get(url).json()
39 | currency = from_currency.strip()+to_currency.strip()
40 | amount = int(amount)
41 | cc = data['quotes'][currency]
42 | cur_conv = cc*amount
43 | E2.insert(0,cur_conv)
44 |
45 | text.insert('end',f'{amount} United State Dollar Equals {cur_conv} {to_currency} \n\n Last Time Update --- \t {datetime.now()}')
46 |
47 | def clear():
48 | E1.delete(0,'end')
49 | E2.delete(0,'end')
50 | text.delete(1.0,'end')
51 |
52 |
53 | l1 = Label(root,text="USD Currency Converter Using Python", font=('verdana','10','bold'))
54 | l1.place(x=150,y=15)
55 |
56 | amt = Label(root,text="Amount",font=('roboto',10,'bold'))
57 | amt.place(x=20,y=15)
58 | E1 = Entry(root,width=20,borderwidth=1,font=('roboto',10,'bold'))
59 | E1.place(x=20,y=40)
60 |
61 | c1 = tk.StringVar()
62 | c2 = tk.StringVar()
63 | currencychoose1 = ttk.Combobox(root, width = 20, textvariable = c1, state='readonly',font=('verdana',10,'bold'))
64 |
65 | # Adding combobox drop down list
66 | currencychoose1['values'] = (
67 | ' USD',
68 | )
69 |
70 | currencychoose1.place(x=300,y=40)
71 | currencychoose1.current(0)
72 |
73 |
74 |
75 | E2 = Entry(root,width=20,borderwidth=1,font=('roboto',10,'bold'))
76 | E2.place(x=20,y=80)
77 |
78 |
79 | currencychoose2 = ttk.Combobox(root, width = 20, textvariable = c2, state='readonly',font=('verdana','10','bold'))
80 |
81 | # Adding combobox drop down list
82 | currencychoose2['values'] =('ALL',
83 | ' AFN',
84 | ' ARS',
85 | ' AWG',
86 | ' AUD',
87 | ' AZN',
88 | ' BSD',
89 | ' BBD',
90 | ' BYN',
91 | ' BZD ',
92 | ' BMD',
93 | ' BOB',
94 | 'BAM',
95 | ' BWP',
96 | ' BGN',
97 | ' BND',
98 | ' KHR',
99 | ' CAD',
100 | ' KYD',
101 | ' CLP',
102 | ' CNY',
103 | ' COP ',
104 | ' CRC',
105 | ' HRK',
106 | 'CUP',
107 | 'CZK',
108 | ' DKK',
109 | ' DOP',
110 | ' XCD',
111 | ' EGP',
112 | ' SVC',
113 | ' EUR',
114 | ' FKP',
115 | ' FJD',
116 | ' GHS ',
117 | ' GIP',
118 | ' GTQ',
119 | 'GGP',
120 | ' GYD',
121 | ' HNL ',
122 | ' HKD',
123 | ' HUF',
124 | ' ISK',
125 | ' INR',
126 | ' IDR',
127 | ' IRR',
128 | ' IMP ',
129 | ' ILS',
130 | ' JMD',
131 | 'JPY',
132 | 'KZT',
133 | ' KPW',
134 | ' KRW',
135 | ' KGS',
136 | ' LAK',
137 | ' LBP',
138 | ' LRD',
139 | ' MKD',
140 | ' MYR',
141 | ' MUR ',
142 | ' MXN',
143 | ' MNT',
144 | 'MZN',
145 | ' NAD',
146 | ' NPR',
147 | ' ANG',
148 | ' NZD ',
149 | ' NIO ',
150 | ' NGN',
151 | ' NOK',
152 | ' OMR ',
153 | ' PKR ',
154 | ' PAB',
155 | ' PYG',
156 | 'PEN',
157 | 'PHP',
158 | ' PLN',
159 | ' QAR',
160 | ' RON',
161 | ' RUB',
162 | ' SHP',
163 | ' SAR',
164 | ' RSD',
165 | ' SCR ',
166 | ' SGD ',
167 | ' SBD',
168 | ' SOS',
169 | 'ZAR',
170 | ' LKR',
171 | ' SEK ',
172 | ' CHF',
173 | ' SRD',
174 | ' SYP',
175 | ' TWD',
176 | ' THB',
177 | ' TTD',
178 | ' TRY ',
179 | ' TVD',
180 | ' UAH',
181 | 'GBP ',
182 | ' UYU',
183 | ' UZS ',
184 | ' VEF ',
185 | ' VND',
186 | ' YER',
187 | 'ZWD',)
188 |
189 | currencychoose2.place(x=300,y=80)
190 | currencychoose2.current()
191 |
192 |
193 | text = Text(root,height=7,width=52,font=('verdana','10','bold'))
194 | text.place(x=100,y=120)
195 |
196 | B = Button(root,text="Search",command=show_data,font=('verdana','10','bold'),borderwidth=2,bg="red",fg="white")
197 | B.place(x=20,y=120)
198 |
199 | clear = Button(root,text="Clear",command=clear,font=('verdana','10','bold'),borderwidth=2,bg="blue",fg="white")
200 | clear.place(x=20,y=170)
201 |
202 | root.mainloop()
203 |
204 | # <============ end code ==============>
--------------------------------------------------------------------------------
/Tic Tac Toe Game/tic_tac_toe.py:
--------------------------------------------------------------------------------
1 | from tkinter import *
2 | from tkinter import messagebox
3 |
4 | root = Tk()
5 | root.title('Tic Tac Toe Game')
6 |
7 | # Player 1 [X] starts first, Player 2 [O] continues
8 | clicked = True
9 | count = 0
10 |
11 | # To disable all the buttons when someone has won the game
12 | def disableButtons():
13 | button1.config(state=DISABLED)
14 | button2.config(state=DISABLED)
15 | button3.config(state=DISABLED)
16 |
17 | button4.config(state=DISABLED)
18 | button5.config(state=DISABLED)
19 | button6.config(state=DISABLED)
20 |
21 | button7.config(state=DISABLED)
22 | button8.config(state=DISABLED)
23 | button9.config(state=DISABLED)
24 |
25 | # To check whether did anyone won the game and restart the game when someone won the game
26 | def checkWinner():
27 | global winner
28 | winner = False
29 |
30 | # Player 1 [X] winning patterns
31 | if button1["text"] == "X" and button2["text"] == "X" and button3["text"] == "X":
32 | button1.config(bg="#80ffaa") #[X][X][X]
33 | button2.config(bg="#80ffaa") #[O][O][ ]
34 | button3.config(bg="#80ffaa") #[ ][ ][ ]
35 | winner = True
36 | messagebox.showinfo("Tic Tac Toe", "Player 1 is the Winner!")
37 | disableButtons
38 | start()
39 |
40 | elif button4["text"] == "X" and button5["text"] == "X" and button6["text"] == "X":
41 | button4.config(bg="#80ffaa") #[O][O][ ]
42 | button5.config(bg="#80ffaa") #[X][X][X]
43 | button6.config(bg="#80ffaa") #[ ][ ][ ]
44 | winner = True
45 | messagebox.showinfo("Tic Tac Toe", "Player 1 is the Winner!")
46 | disableButtons
47 | start()
48 |
49 | elif button7["text"] == "X" and button8["text"] == "X" and button9["text"] == "X":
50 | button7.config(bg="#80ffaa") #[ ][ ][ ]
51 | button8.config(bg="#80ffaa") #[O][O][ ]
52 | button9.config(bg="#80ffaa") #[X][X][X]
53 | winner = True
54 | messagebox.showinfo("Tic Tac Toe", "Player 1 is the Winner!")
55 | disableButtons
56 | start()
57 |
58 | elif button1["text"] == "X" and button4["text"] == "X" and button7["text"] == "X":
59 | button1.config(bg="#80ffaa") #[X][O][ ]
60 | button4.config(bg="#80ffaa") #[X][O][ ]
61 | button7.config(bg="#80ffaa") #[X][ ][ ]
62 | winner = True
63 | messagebox.showinfo("Tic Tac Toe", "Player 1 is the Winner!")
64 | disableButtons
65 | start()
66 |
67 | elif button2["text"] == "X" and button5["text"] == "X" and button8["text"] == "X":
68 | button2.config(bg="#80ffaa") #[O][X][ ]
69 | button5.config(bg="#80ffaa") #[O][X][ ]
70 | button8.config(bg="#80ffaa") #[ ][X][ ]
71 | winner = True
72 | messagebox.showinfo("Tic Tac Toe", "Player 1 is the Winner!")
73 | disableButtons
74 | start()
75 |
76 | elif button3["text"] == "X" and button6["text"] == "X" and button9["text"] == "X":
77 | button3.config(bg="#80ffaa") #[ ][O][X]
78 | button6.config(bg="#80ffaa") #[ ][O][X]
79 | button9.config(bg="#80ffaa") #[ ][ ][X]
80 | winner = True
81 | messagebox.showinfo("Tic Tac Toe", "Player 1 is the Winner!")
82 | disableButtons
83 | start()
84 |
85 | elif button1["text"] == "X" and button5["text"] == "X" and button9["text"] == "X":
86 | button1.config(bg="#80ffaa") #[X][O][ ]
87 | button5.config(bg="#80ffaa") #[ ][X][ ]
88 | button9.config(bg="#80ffaa") #[ ][O][X]
89 | winner = True
90 | messagebox.showinfo("Tic Tac Toe", "Player 1 is the Winner!")
91 | disableButtons
92 | start()
93 |
94 | elif button3["text"] == "X" and button5["text"] == "X" and button7["text"] == "X":
95 | button3.config(bg="#80ffaa") #[ ][O][X]
96 | button5.config(bg="#80ffaa") #[ ][X][ ]
97 | button7.config(bg="#80ffaa") #[X][O][ ]
98 | winner = True
99 | messagebox.showinfo("Tic Tac Toe", "Player 1 is the Winner!")
100 | disableButtons
101 | start()
102 |
103 | # Player 2 [O] winning patterns
104 | elif button1["text"] == "O" and button2["text"] == "O" and button3["text"] == "O":
105 | button1.config(bg="#80ffaa") #[O][O][O]
106 | button2.config(bg="#80ffaa") #[X][X][ ]
107 | button3.config(bg="#80ffaa") #[X][ ][ ]
108 | winner = True
109 | messagebox.showinfo("Tic Tac Toe", "Player 2 is the Winner!")
110 | disableButtons
111 | start()
112 |
113 | elif button4["text"] == "O" and button5["text"] == "O" and button6["text"] == "O":
114 | button4.config(bg="#80ffaa") #[X][X][ ]
115 | button5.config(bg="#80ffaa") #[O][O][O]
116 | button6.config(bg="#80ffaa") #[X][ ][ ]
117 | winner = True
118 | messagebox.showinfo("Tic Tac Toe", "Player 2 is the Winner!")
119 | disableButtons
120 | start()
121 |
122 | elif button7["text"] == "O" and button8["text"] == "O" and button9["text"] == "O":
123 | button7.config(bg="#80ffaa") #[X][ ][ ]
124 | button8.config(bg="#80ffaa") #[X][X][ ]
125 | button9.config(bg="#80ffaa") #[O][O][O]
126 | winner = True
127 | messagebox.showinfo("Tic Tac Toe", "Player 2 is the Winner!")
128 | disableButtons
129 | start()
130 |
131 | elif button1["text"] == "O" and button4["text"] == "O" and button7["text"] == "O":
132 | button1.config(bg="#80ffaa") #[O][X][X]
133 | button4.config(bg="#80ffaa") #[O][X][ ]
134 | button7.config(bg="#80ffaa") #[O][ ][ ]
135 | winner = True
136 | messagebox.showinfo("Tic Tac Toe", "Player 2 is the Winner!")
137 | disableButtons
138 | start()
139 |
140 | elif button2["text"] == "O" and button5["text"] == "O" and button8["text"] == "O":
141 | button2.config(bg="#80ffaa") #[X][O][X]
142 | button5.config(bg="#80ffaa") #[X][O][ ]
143 | button8.config(bg="#80ffaa") #[ ][O][ ]
144 | winner = True
145 | messagebox.showinfo("Tic Tac Toe", "Player 2 is the Winner!")
146 | disableButtons
147 | start()
148 |
149 | elif button3["text"] == "O" and button6["text"] == "O" and button9["text"] == "O":
150 | button3.config(bg="#80ffaa") #[X][X][O]
151 | button6.config(bg="#80ffaa") #[ ][X][O]
152 | button9.config(bg="#80ffaa") #[ ][ ][O]
153 | winner = True
154 | messagebox.showinfo("Tic Tac Toe", "Player 2 is the Winner!")
155 | disableButtons
156 | start()
157 |
158 | elif button1["text"] == "O" and button5["text"] == "O" and button9["text"] == "O":
159 | button1.config(bg="#80ffaa") #[O][X][X]
160 | button5.config(bg="#80ffaa") #[ ][O][ ]
161 | button9.config(bg="#80ffaa") #[ ][X][O]
162 | winner = True
163 | messagebox.showinfo("Tic Tac Toe", "Player 2 is the Winner!")
164 | disableButtons
165 | start()
166 |
167 | elif button3["text"] == "O" and button5["text"] == "O" and button7["text"] == "O":
168 | button3.config(bg="#80ffaa") #[X][X][O]
169 | button5.config(bg="#80ffaa") #[ ][O][ ]
170 | button7.config(bg="#80ffaa") #[O][X][ ]
171 | winner = True
172 | messagebox.showinfo("Tic Tac Toe", "Player 2 is the Winner!")
173 | disableButtons
174 | start()
175 |
176 | # To check whether the game is a draw
177 | def checkDraw():
178 | global count, winner
179 |
180 | if count == 9 and winner == False:
181 | messagebox.showerror("Tic Tac Toe", "Draw, play again!")
182 | start()
183 |
184 | # To determine the buttons that Player 1 or Player 2 has clicked on
185 | def buttonClicked(button):
186 | global clicked, count
187 |
188 | if button["text"] == " " and clicked == True:
189 | button["text"] = "X"
190 | clicked = False
191 | count += 1
192 | checkWinner()
193 | checkDraw()
194 | elif button["text"] == " " and clicked == False:
195 | button["text"] = "O"
196 | clicked = True
197 | count += 1
198 | checkWinner()
199 | checkDraw()
200 | else:
201 | messagebox.showerror("Tic Tac Toe", "Please select another box.")
202 |
203 | # To start or restart the game
204 | def start():
205 | global button1, button2, button3, button4, button5, button6, button7, button8, button9
206 | global clicked, count
207 | clicked = True
208 | count = 0
209 |
210 | # Building the buttons for the game
211 | button1 = Button(root, text=" ", font=("Helvetica, 20"), height=3, width=7, bg="SystemButtonFace", command=lambda: buttonClicked(button1))
212 | button2 = Button(root, text=" ", font=("Helvetica, 20"), height=3, width=7, bg="SystemButtonFace", command=lambda: buttonClicked(button2))
213 | button3 = Button(root, text=" ", font=("Helvetica, 20"), height=3, width=7, bg="SystemButtonFace", command=lambda: buttonClicked(button3))
214 |
215 | button4 = Button(root, text=" ", font=("Helvetica, 20"), height=3, width=7, bg="SystemButtonFace", command=lambda: buttonClicked(button4))
216 | button5 = Button(root, text=" ", font=("Helvetica, 20"), height=3, width=7, bg="SystemButtonFace", command=lambda: buttonClicked(button5))
217 | button6 = Button(root, text=" ", font=("Helvetica, 20"), height=3, width=7, bg="SystemButtonFace", command=lambda: buttonClicked(button6))
218 |
219 | button7 = Button(root, text=" ", font=("Helvetica, 20"), height=3, width=7, bg="SystemButtonFace", command=lambda: buttonClicked(button7))
220 | button8 = Button(root, text=" ", font=("Helvetica, 20"), height=3, width=7, bg="SystemButtonFace", command=lambda: buttonClicked(button8))
221 | button9 = Button(root, text=" ", font=("Helvetica, 20"), height=3, width=7, bg="SystemButtonFace", command=lambda: buttonClicked(button9))
222 |
223 | # Arranging the buttons on the screen for the game
224 | button1.grid(row=0, column=0)
225 | button2.grid(row=0, column=1)
226 | button3.grid(row=0, column=2)
227 |
228 | button4.grid(row=1, column=0)
229 | button5.grid(row=1, column=1)
230 | button6.grid(row=1, column=2)
231 |
232 | button7.grid(row=2, column=0)
233 | button8.grid(row=2, column=1)
234 | button9.grid(row=2, column=2)
235 |
236 | # Create game menu
237 | gameMenu = Menu(root)
238 | root.config(menu = gameMenu)
239 |
240 | # Create game options menu
241 | optionMenu = Menu(gameMenu, tearoff=False)
242 | gameMenu.add_cascade(label="Options", menu=optionMenu)
243 | optionMenu.add_command(label="Restart Game", command=start)
244 |
245 |
246 | start()
247 | root.mainloop()
--------------------------------------------------------------------------------
/Notepad/notepad.py:
--------------------------------------------------------------------------------
1 | from tkinter import *
2 | import tkinter as tk
3 | from tkinter.scrolledtext import ScrolledText
4 | from tkinter import filedialog
5 | from tkinter import messagebox,font
6 | from tkinter import ttk
7 | from datetime import datetime
8 | import webbrowser
9 |
10 |
11 | #======================================================================================
12 | # ========================== File Code Starts Here ============================
13 | #=======================================================================================
14 |
15 |
16 | #=================================== New Code ======================================
17 | def new():
18 | text.delete('1.0','end')
19 | #===================================== End =========================================
20 |
21 |
22 | # ========================= New Window Code ================================
23 | def new_window():
24 | root = tk.Tk()
25 | root.geometry('500x500')
26 |
27 |
28 | menubar = Menu(root)
29 |
30 | file = Menu(menubar,tearoff = 0)
31 | file.add_command(label="New",command=new)
32 | file.add_command(label="New window",command=new_window)
33 | file.add_command(label="Open",command=Open)
34 | file.add_command(label="Save",command=save)
35 | file.add_command(label="Save as", command=save_as)
36 | file.add_separator()
37 | file.add_command(label="Exit",command=exit)
38 | menubar.add_cascade(label="File",menu=file,font=('verdana',10,'bold'))
39 |
40 |
41 |
42 | edit = Menu(menubar,tearoff = 0)
43 |
44 | edit.add_command(label="Undo",command=undo)
45 | edit.add_separator()
46 | edit.add_command(label="Cut",command=cut)
47 | edit.add_command(label="Copy",command=copy)
48 | edit.add_command(label="Paste",command=paste)
49 | edit.add_command(label="Delete",command=delete)
50 | edit.add_command(label="Select All",accelerator="Ctrl+A",command=select_all)
51 | edit.add_command(label="Time/Date",accelerator="F5",command=time)
52 | menubar.add_cascade(label="Edit",menu=edit)
53 |
54 |
55 | Format = Menu(menubar, tearoff = 0)
56 |
57 | Format.add_command(label="Word Wrap")
58 | Format.add_command(label="Font...", command=fonts)
59 |
60 | menubar.add_cascade(label="Format",menu=Format)
61 |
62 |
63 |
64 | Help = Menu(menubar, tearoff = 0)
65 |
66 | Help.add_command(label="View Help",command=view_help)
67 | Help.add_command(label="Send FeedBack",command=send_feedback)
68 | Help.add_command(label="About Notepad")
69 |
70 | menubar.add_cascade(label="Help",menu=Help)
71 |
72 |
73 | root.config(menu=menubar)
74 |
75 |
76 |
77 |
78 |
79 | text = ScrolledText(root,width=1000,height=1000)
80 | text.place(x=0,y=0)
81 |
82 |
83 |
84 | root.mainloop()
85 |
86 | # =========================== End ==============================================
87 |
88 |
89 | # ===================== Open File Code ========================================
90 | def Open():
91 | root.filename = filedialog.askopenfilename(
92 | initialdir = '/',
93 | title="Select file",
94 | filetypes=(("jpeg files","*.jpg"),("all files","*.*")))
95 | file = open(root.filename)
96 | text.insert('end',file.read())
97 | #================================= End ==========================================
98 |
99 |
100 | #================================ Save File Code ====================================
101 | def save():
102 | pass
103 | #================================ End =======================================
104 |
105 | #=================================== save as File code ==============================
106 | def save_as():
107 | root.filename = filedialog.asksaveasfile(mode="w",defaultextension='.txt')
108 | if root.filename is None:
109 | return
110 | file_save = str(text.get(1.0,END))
111 | root.filename.write(file_save)
112 | root.filename.close()
113 | # ================================ End ============================================
114 |
115 | # ================================ Exit Code =====================================
116 | def exit():
117 | message = messagebox.askquestion('Notepad',"Do you want to save changes")
118 | if message == "yes":
119 | save_as()
120 | else:
121 | root.destroy()
122 | #==================================== end =========================================
123 |
124 |
125 |
126 |
127 | #======================================================================================
128 | # ======================= Edit Code Starts Here ============================
129 | #=======================================================================================
130 |
131 | #=========================== Cut code =============================
132 | def cut():
133 | text.event_generate("<>")
134 |
135 | #=========================== End code =====================================
136 |
137 | #=========================== Cut code =============================
138 | def copy():
139 | text.event_generate("<>")
140 |
141 | #=========================== End code =====================================
142 |
143 | #=========================== Cut code =============================
144 | def paste():
145 | text.event_generate("<>")
146 |
147 | #=========================== End code =====================================
148 |
149 |
150 | #=========================== Delete all code =============================
151 | def delete():
152 | message = messagebox.askquestion('Notepad',"Do you want to Delete all")
153 | if message == "yes":
154 | text.delete('1.0','end')
155 | else:
156 | return "break"
157 |
158 |
159 | #=========================== End code =====================================
160 |
161 |
162 | #=========================== select all code =============================
163 | def select_all():
164 | text.tag_add('sel','1.0','end')
165 | return 'break'
166 | #=========================== End code =============================
167 |
168 |
169 | #=========================== Time/Date code =============================
170 | def time():
171 | d = datetime.now()
172 | text.insert('end',d)
173 |
174 | #=========================== End code =============================
175 |
176 |
177 |
178 | #======================================================================================
179 | # ======================= Edit Code Ends Here ============================
180 | #=======================================================================================
181 |
182 |
183 |
184 |
185 | #======================================================================================
186 | # ======================= Format Code Starts Here ============================
187 | #=======================================================================================
188 |
189 |
190 | def fonts():
191 | root = tk.Tk()
192 | root.geometry('400x400')
193 | root.title('Font')
194 |
195 | l1 = Label(root,text="Font:")
196 | l1.place(x=10,y=10)
197 | f = tk.StringVar()
198 | fonts = ttk.Combobox(root, width = 15, textvariable = f, state='readonly',font=('verdana',10,'bold'),)
199 | fonts['values'] = font.families()
200 | fonts.place(x=10,y=30)
201 | fonts.current(0)
202 |
203 |
204 | l2 = Label(root,text="Font Style:")
205 | l2.place(x=180,y=10)
206 | st = tk.StringVar()
207 | style = ttk.Combobox(root, width = 15, textvariable = st, state='readonly',font=('verdana',10,'bold'),)
208 | style['values'] = ('bold','bold italic','italic')
209 | style.place(x=180,y=30)
210 | style.current(0)
211 |
212 | l3 = Label(root,text="Size:")
213 | l3.place(x=350,y=10)
214 | sz = tk.StringVar()
215 | size = ttk.Combobox(root, width = 2, textvariable = sz, state='readonly',font=('verdana',10,'bold'),)
216 |
217 | size['values'] = (8,9,10,12,15,20,23,25,27,30,35,40,43,47,50,55,65,76,80,90,100,150,200,255,300)
218 | size.place(x=350,y=30)
219 | size.current(0)
220 |
221 |
222 | sample = LabelFrame(root,text="Sample",height=100,width=200)
223 | sample['font'] = (fonts.get(),size.get(),style.get())
224 | sample.place(x=180,y=220)
225 |
226 | l4 = Label(sample,text="This is sample")
227 | l4.place(x=20,y=30)
228 |
229 |
230 |
231 | def OK():
232 |
233 | text['font'] = (fonts.get(),size.get(),style.get())
234 | root.destroy()
235 |
236 |
237 | ok = Button(root,text="OK",relief=RIDGE,borderwidth=2,padx=20,highlightcolor="blue",command=OK)
238 | ok.place(x=137,y=350)
239 |
240 | def Apl():
241 | l4['font'] = (fonts.get(),size.get(),style.get())
242 |
243 | Apply = Button(root,text="Apply",relief=RIDGE,borderwidth=2,padx=20,highlightcolor="blue",command=Apl)
244 | Apply.place(x=210,y=350)
245 |
246 | def Cnl():
247 | root.destroy()
248 |
249 | cancel = Button(root,text="Cancel",relief=RIDGE,borderwidth=2,padx=20,command=Cnl)
250 | cancel.place(x=295,y=350)
251 | root.mainloop()
252 |
253 |
254 | #======================================================================================
255 | # ======================= Format Code Ends Here ============================
256 | #=======================================================================================
257 |
258 | #======================================================================================
259 | # ======================= Help Code Ends Here ============================
260 | #=======================================================================================
261 |
262 | # ====================== View Help ===================================
263 | def view_help():
264 | webbrowser.open('#')
265 |
266 | #============================= End =======================================
267 |
268 | # ====================== View Help ===================================
269 | def send_feedback():
270 | webbrowser.open('#')
271 |
272 | #============================= End =======================================
273 |
274 |
275 | #======================================================================================
276 | # ======================= Help Code Ends Here ============================
277 | #=======================================================================================
278 |
279 |
280 | # ============================= Main Window =============================
281 |
282 | root = tk.Tk()
283 | root.geometry('600x300')
284 | root.minsize(200,100)
285 | root.title('notepad')
286 | root.iconbitmap('notepad.ico')
287 | text = ScrolledText(root,height=1000,undo=True)
288 | text.pack(fill=tk.BOTH)
289 |
290 | menubar = Menu(root)
291 |
292 | file = Menu(menubar,tearoff = 0)
293 | file.add_command(label="New",command=new)
294 | file.add_command(label="New window",command=new_window)
295 | file.add_command(label="Open",command=Open)
296 | file.add_command(label="Save",command=save)
297 | file.add_command(label="Save as", command=save_as)
298 | file.add_separator()
299 | file.add_command(label="Exit",command=exit)
300 | menubar.add_cascade(label="File",menu=file,font=('verdana',10,'bold'))
301 |
302 |
303 |
304 | edit = Menu(menubar,tearoff = 0)
305 |
306 | edit.add_command(label="Undo",accelerator="Ctrl+Z",command=text.edit_undo)
307 | edit.add_command(label="Redo",accelerator="Ctrl+Y",command=text.edit_redo)
308 | edit.add_separator()
309 | edit.add_command(label="Cut",accelerator="Ctrl+X",command=cut)
310 | edit.add_command(label="Copy",accelerator="Ctrl+C",command=copy)
311 | edit.add_command(label="Paste",accelerator="Ctrl+V",command=paste)
312 | edit.add_command(label="Delete",accelerator="Del",command=delete)
313 | edit.add_command(label="Select All",accelerator="Ctrl+A",command=select_all)
314 | edit.add_command(label="Time/Date",accelerator="F5",command=time)
315 | menubar.add_cascade(label="Edit",menu=edit)
316 |
317 |
318 | Format = Menu(menubar, tearoff = 0)
319 |
320 | Format.add_command(label="Word Wrap")
321 | Format.add_command(label="Font...", command=fonts)
322 |
323 | menubar.add_cascade(label="Format",menu=Format)
324 |
325 |
326 |
327 | Help = Menu(menubar, tearoff = 0)
328 |
329 | Help.add_command(label="View Help",command=view_help)
330 | Help.add_command(label="Send FeedBack",command=send_feedback)
331 | Help.add_command(label="About Notepad")
332 |
333 | menubar.add_cascade(label="Help",menu=Help)
334 |
335 | # ======================== Right Click Menu =========================================
336 |
337 | m = Menu(root, tearoff = 0)
338 | m.add_command(label ="Select All",accelerator="Ctrl+A",command=select_all)
339 | m.add_command(label ="Cut",accelerator="Ctrl+X",command=cut)
340 | m.add_command(label ="Copy",accelerator="Ctrl+C",command=copy)
341 | m.add_command(label ="Paste",accelerator="Ctrl+V",command=paste)
342 | m.add_command(label ="Delete",accelerator="Del",command=delete)
343 | m.add_separator()
344 | m.add_command(label ="Undo",accelerator="Ctrl+Z",command=text.edit_undo)
345 | m.add_command(label ="Redo",accelerator="Ctrl+Z",command=text.edit_redo)
346 |
347 | def do_popup(event):
348 | try:
349 | m.tk_popup(event.x_root, event.y_root)
350 | finally:
351 | m.grab_release()
352 |
353 | root.bind("", do_popup)
354 |
355 | # ==============================================================================
356 |
357 | root.config(menu=menubar)
358 | root.mainloop()
359 |
360 | # ========================== End =======================================
361 |
--------------------------------------------------------------------------------
/Advance Youtube Downloader/yt-downloader.py:
--------------------------------------------------------------------------------
1 | # =================== PASSED ===========================
2 | # Fix Resolution Software Youtube Video Downloader
3 | # Add someone variabel in video downloader
4 | # And pop up show messagebox download started
5 | # ======================================================
6 |
7 |
8 |
9 | # ================= Importing Modules ===================
10 | from tkinter import *
11 | import tkinter as tk
12 | from datetime import datetime
13 | from PIL import ImageTk, Image
14 | from tkinter.filedialog import askdirectory
15 | from tkinter import messagebox
16 | import time
17 | from pytube import YouTube
18 | from pytube import Playlist
19 | from tkinter.ttk import Progressbar
20 | from tkinter.scrolledtext import ScrolledText
21 | import os
22 | # ===========================================================
23 | youtubeLogo = os.path.join(os.getcwd(), "Advance Youtube Downloader\youtube.png")
24 | class YoutubeDownloader():
25 |
26 | # ========== Video Path ===================
27 | def select_v_path(self):
28 | self.location = askdirectory()
29 |
30 | if self.video_path.get() != "":
31 | self.video_path.delete(0,END)
32 | self.video_path.insert(END,self.location)
33 | else:
34 | self.video_path.insert(END,self.location)
35 |
36 | # ============= Playlist Path ================
37 | def select_p_path(self):
38 | self.location = askdirectory()
39 |
40 | if self.playlist_path.get() != "":
41 | self.playlist_path.delete(0,END)
42 | self.playlist_path.insert(END,self.location)
43 | else:
44 | self.playlist_path.insert(END,self.location)
45 |
46 |
47 | # ======================= Downloading Video ====================
48 | def download_video(self):
49 | if self.video_url.get() == "":
50 | messagebox.showerror("Error","Please Paste Video URL")
51 | elif 'https://' not in self.video_url.get():
52 | messagebox.showerror("Error","Wrong Video Url")
53 | elif self.video_path.get() == "":
54 | messagebox.showerror("Error","Please provide Path")
55 | else:
56 | # try:
57 | # Just fix resolution video and add variabel in video downloader
58 | # And create messagebox show info download started.
59 | self.url = self.video_url.get()
60 | self.path = self.video_path.get()
61 | self.video = YouTube(self.url).streams
62 | self.stream = self.video.filter(
63 | file_extension="mp4", res="720p",
64 | only_audio=False
65 | ).first()
66 | messagebox.showinfo("Information Download Video", "Download Started Just Wait Pop Up Show For Done Download Video.")
67 |
68 | self.root = tk.Tk()
69 | self.root.geometry('300x150')
70 | self.root.maxsize(300,150)
71 | self.root.minsize(300,150)
72 | self.root.title('Video Dowloading')
73 | self.root['bg'] = "white"
74 |
75 |
76 | self.start_downloading = Label(self.root,text="Video downloading .....",fg="red",font=('verdana',10,'bold'),bg="white")
77 | self.start_downloading.place(x=40,y=10)
78 |
79 | self.stream.download(output_path = self.path,filename=None)
80 |
81 | self.progress = Progressbar(self.root,orient = HORIZONTAL,length=250,mode='determinate')
82 | self.progress['value'] = 20
83 | self.root.update_idletasks()
84 | self.progress['value'] = 40
85 | self.root.update_idletasks()
86 | self.progress['value'] = 60
87 | self.root.update_idletasks()
88 | self.progress['value'] = 80
89 | self.root.update_idletasks()
90 | self.progress['value'] = 100
91 | self.root.update_idletasks()
92 | self.progress.place(x=20,y=40)
93 |
94 | self.dow_details = ScrolledText(self.root,width=30,height=3,font=('verdana',8,'bold'))
95 | self.dow_details.place(x=20,y=70)
96 | self.dow_details.insert(END,f'{self.video_path.get()}')
97 |
98 | self.dow_success = Label(self.root,text="Video downloaded successfully .....",fg="red",font=('verdana',10,'bold'),bg="white")
99 | self.dow_success.place(x=10,y=120)
100 |
101 | self.root.mainloop()
102 |
103 |
104 | # except:
105 | # time.sleep(10)
106 | # messagebox.showerror("Error","Unable to Download Video | Something went wrong !!")
107 |
108 | # ========================= End ==============================
109 |
110 |
111 | # ======================= Downloading Playlist ====================
112 | def download_playlist(self):
113 | if self.playlist_url.get() == "":
114 | messagebox.showerror("Error","Please Paste playlist URL")
115 | elif 'https://' not in self.playlist_url.get():
116 | messagebox.showerror("Error","Wrong playlist Url")
117 | elif self.playlist_path.get() == "":
118 | messagebox.showerror("Error","Please provide Path")
119 | else:
120 | try:
121 | self.url = self.playlist_url.get()
122 | self.path = self.playlist_path.get()
123 | self.playlist = Playlist(self.url)
124 |
125 | self.root = tk.Tk()
126 | self.root.geometry('300x150')
127 | self.root.maxsize(300,150)
128 | self.root.minsize(300,150)
129 | self.root.title('Playlist Dowloading')
130 | self.root['bg'] = "white"
131 |
132 |
133 | self.start_downloading = Label(self.root,text="Playlist downloading .....",fg="red",font=('verdana',10,'bold'),bg="white")
134 | self.start_downloading.place(x=40,y=10)
135 |
136 | for self.video in self.playlist:
137 | self.video.streams.get_highest_resolution().download(output_path = self.path,filename=None)
138 |
139 | self.progress = Progressbar(self.root,orient = HORIZONTAL,length=250,mode='determinate')
140 | self.progress['value'] = 20
141 | self.root.update_idletasks()
142 | self.progress['value'] = 40
143 | self.root.update_idletasks()
144 | self.progress['value'] = 60
145 | self.root.update_idletasks()
146 | self.progress['value'] = 80
147 | self.root.update_idletasks()
148 | self.progress['value'] = 100
149 | self.root.update_idletasks()
150 | self.progress.place(x=20,y=40)
151 |
152 | self.dow_details = ScrolledText(self.root,width=30,height=3,font=('verdana',8,'bold'))
153 | self.dow_details.place(x=20,y=70)
154 | self.dow_details.insert(END,f'{self.playlist_path.get()}\n {self.video.title}')
155 |
156 | self.dow_success = Label(self.root,text="Playlist downloaded successfully .....",fg="red",font=('verdana',10,'bold'),bg="white")
157 | self.dow_success.place(x=10,y=120)
158 |
159 | self.root.mainloop()
160 |
161 |
162 | except:
163 | time.sleep(10)
164 | messagebox.showerror("Error","Unable to Download Video | Something went wrong !!")
165 |
166 | # ========================= End ==============================
167 |
168 | # ======================== Clear =======================
169 |
170 | def Clear(self):
171 | self.video_url.delete(0,END)
172 | self.video_path.delete(0,END)
173 | self.playlist_url.delete(0,END)
174 | self.playlist_path.delete(0,END)
175 |
176 | # ======================== Quit =======================
177 | def Quit(self):
178 | self.root.destroy()
179 |
180 |
181 |
182 | # ============================== Main Window ========================
183 | def __init__(self):
184 | self.root = tk.Tk()
185 | self.root.geometry('500x270')
186 | self.root.maxsize(500,270)
187 | self.root.minsize(500,270)
188 | self.root['bg']="white"
189 | self.root.title('Youtube Downloader')
190 |
191 | self.l1 = Label(self.root,text="Youtube Downloader",font=('verdana',15,'bold'),bg="white",fg="red")
192 | self.l1.place(x=130,y=5)
193 |
194 | self.design1 = Label(self.root,bg="red",width=20)
195 | self.design1.place(x=0,y=45)
196 |
197 | self.date = Label(self.root,text=datetime.now(),font=('verdana',10,'bold'),bg="white")
198 | self.date.place(x=140,y=45)
199 |
200 | self.design2 = Label(self.root,bg="red",width=20)
201 | self.design2.place(x=360,y=45)
202 |
203 | self.design3 = Label(self.root,bg="red",width=3,height=6)
204 | self.design3.place(x=242,y=90)
205 |
206 | self.yt_icon = ImageTk.PhotoImage(Image.open(youtubeLogo, mode="r"))
207 | self.logo = Label(self.root,image=self.yt_icon,bg="white")
208 | self.logo.place(x=220,y=70)
209 |
210 |
211 | # ==================== Video ============================
212 |
213 | self.frame1 = LabelFrame(self.root,text="Download Video",width=180,height=180,font=('verdana',10,'bold'),bg="white",fg="red",borderwidth=5,relief=SUNKEN,highlightcolor="red",highlightbackground="red")
214 | self.frame1.place(x=10,y=80)
215 |
216 | self.v_url = Label(self.frame1,text="Paste url Here ...",font=('verdana',10,'bold'),bg="white")
217 | self.v_url.place(x=20,y=2)
218 |
219 | self.video_url = Entry(self.frame1,width=24,relief=SUNKEN,borderwidth=2,bg="red",fg="white")
220 | self.video_url.place(x=10,y=30)
221 |
222 | self.v_path = Label(self.frame1,text="Select Path",font=('verdana',10,'bold'),bg="white")
223 | self.v_path.place(x=10,y=60)
224 |
225 | self.video_path = Entry(self.frame1,width=15,relief=SUNKEN,borderwidth=2,bg="red",fg="white")
226 | self.video_path.place(x=10,y=90)
227 |
228 | self.file = Button(self.frame1,text="Browser",font=('verdana',8,'bold'),relief=RAISED,bg="white",command=self.select_v_path)
229 | self.file.place(x=105,y=88)
230 |
231 | self.download_video = Button(self.frame1,text="Download",font=('verdana',9,'bold'),relief=RAISED,bg="white",borderwidth=4,command=self.download_video)
232 | self.download_video.place(x=40,y=125)
233 |
234 |
235 | # =============== Palylist =======================
236 |
237 | self.frame2 = LabelFrame(self.root,text="Download Playlist",width=180,height=180,font=('verdana',10,'bold'),bg="white",fg="red",borderwidth=5,relief=SUNKEN,highlightcolor="red",highlightbackground="red")
238 | self.frame2.place(x=310,y=80)
239 |
240 | self.p_url = Label(self.frame2,text="Paste url Here ...",font=('verdana',10,'bold'),bg="white")
241 | self.p_url.place(x=20,y=2)
242 |
243 | self.playlist_url = Entry(self.frame2,width=24,relief=SUNKEN,borderwidth=2,bg="red",fg="white")
244 | self.playlist_url.place(x=10,y=30)
245 |
246 | self.p_path = Label(self.frame2,text="Select Path",font=('verdana',10,'bold'),bg="white")
247 | self.p_path.place(x=10,y=60)
248 |
249 | self.playlist_path = Entry(self.frame2,width=15,relief=SUNKEN,borderwidth=2,bg="red",fg="white")
250 | self.playlist_path.place(x=10,y=90)
251 |
252 | self.playlist_file = Button(self.frame2,text="Browser",font=('verdana',8,'bold'),relief=RAISED,bg="white",command=self.select_p_path)
253 | self.playlist_file.place(x=105,y=88)
254 |
255 | self.download_playlist = Button(self.frame2,text="Download",font=('verdana',9,'bold'),relief=RAISED,bg="white",borderwidth=4,command=self.download_playlist)
256 | self.download_playlist.place(x=40,y=125)
257 |
258 | self.clear = Button(self.root,text="Clear",font=('verdana',10,'bold'),bg="white",fg="red",padx=10,relief=RAISED,borderwidth=3,command=self.Clear)
259 | self.clear.place(x=220,y=195)
260 |
261 | self.quit = Button(self.root,text="Quit",font=('verdana',10,'bold'),bg="red",fg="white",padx=15,relief=RAISED,borderwidth=3,command=self.Quit)
262 | self.quit.place(x=220,y=230)
263 |
264 | self.root.mainloop()
265 |
266 | # =========================== End =====================================
267 |
268 | # ============== Calling ===========
269 |
270 | if __name__ == '__main__':
271 | YoutubeDownloader()
272 |
273 | #====================================
274 |
--------------------------------------------------------------------------------
/cafe management system/cafe-management.py:
--------------------------------------------------------------------------------
1 | from tkinter import *
2 | import tkinter as tk
3 | from datetime import datetime
4 | from PIL import ImageTk, Image
5 | from tkinter import messagebox
6 |
7 | class cafe_management():
8 |
9 |
10 |
11 | # ============== Total Bill Code =================
12 |
13 | def Total_Bill(self):
14 | self.tea_price = 10
15 | self.coffee_price = 20
16 | self.sandwitch_price = 50
17 | self.cake_price = 100
18 | self.burger_price = 50
19 | self.pizza_price = 150
20 | self.fries_price = 80
21 | self.pepsi_price = 80
22 |
23 | if self.tea_item.get() != "":
24 | self.tea_cost = self.tea_price * int(self.tea_item.get())
25 | else:
26 | self.tea_cost = 0
27 | if self.coffee_item.get() != "":
28 | self.coffee_cost = self.coffee_price * int(self.coffee_item.get())
29 | else:
30 | self.coffee_cost = 0
31 | if self.sandwitch_item.get() != "":
32 | self.sandwitch_cost = self.sandwitch_price * int(self.sandwitch_item.get())
33 | else:
34 | self.sandwitch_cost = 0
35 | if self.cake_item.get() != "":
36 | self.cake_cost = self.cake_price * int(self.cake_item.get())
37 | else:
38 | self.cake_cost = 0
39 | if self.burger_item.get() != "":
40 | self.burger_cost = self.burger_price * int(self.burger_item.get())
41 | else:
42 | self.burger_cost = 0
43 | if self.pizza_item.get() != "":
44 | self.pizza_cost = self.pizza_price * int(self.pizza_item.get())
45 | else:
46 | self.pizza_cost = 0
47 | if self.fries_item.get() != "":
48 | self.fries_cost = self.fries_price * int(self.fries_item.get())
49 | else:
50 | self.fries_cost = 0
51 | if self.pepsi_item.get() != "":
52 | self.pepsi_cost = self.pepsi_price * int(self.pepsi_item.get())
53 | else:
54 | self.pepsi_cost = 0
55 |
56 |
57 | self.Total_Bill = self.pepsi_cost + self.fries_cost + self.pizza_cost + self.burger_cost + self.cake_cost + self.sandwitch_cost + self.coffee_cost + self.tea_cost
58 |
59 | if self.items_cost != "":
60 | self.items_cost.delete(0,END)
61 | self.items_cost.insert(END,self.Total_Bill)
62 | else:
63 | self.items_cost.insert(END,self.Total_Bill)
64 | if self.service_cost != "":
65 | self.service_cost.delete(0,END)
66 | self.service_cost.insert(END,10.0)
67 | else:
68 | self.service_cost.insert(END,10.0)
69 | if self.sub_cost != "":
70 | self.sub_cost.delete(0,END)
71 | self.sub_cost.insert(END,int(self.items_cost.get()) + float(self.service_cost.get()))
72 | else:
73 | self.sub_cost.insert(END,int(self.items_cost.get()) + float(self.service_cost.get()))
74 | if self.paid_tax != "":
75 | self.paid_tax.delete(0,END)
76 | self.paid_tax.insert(END,float(self.sub_cost.get())*8/100)
77 | else:
78 | self.paid_tax.insert(END,float(self.sub_cost.get())*8/100)
79 |
80 | if self.total_bill != "":
81 | self.total_bill.delete(0,END)
82 | self.total_bill.insert(END,float(self.sub_cost.get())+float(self.paid_tax.get()))
83 | else:
84 | self.total_bill.insert(END,float(self.sub_cost.get())+float(self.paid_tax.get()))
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 | # ===== Calculator code ================
94 |
95 | def nine(self):
96 | if 'error' in self.result.get() or '=' in self.result.get():
97 | self.result.delete(0,"end")
98 | self.result.insert("end","9")
99 | else:
100 | self.result.insert("end","9")
101 |
102 |
103 |
104 | def eight(self):
105 | if 'error' in self.result.get() or '=' in self.result.get():
106 | self.result.delete(0,"end")
107 | self.result.insert("end","8")
108 | else:
109 | self.result.insert("end","8")
110 |
111 | def seven(self):
112 | if 'error' in self.result.get() or '=' in self.result.get():
113 | self.result.delete(0,"end")
114 | self.result.insert("end","7")
115 | else:
116 | self.result.insert("end","7")
117 |
118 | def six(self):
119 | if 'error' in self.result.get() or '=' in self.result.get():
120 | self.result.delete(0,"end")
121 | self.result.insert("end","6")
122 | else:
123 | self.result.insert("end","6")
124 |
125 | def five(self):
126 | if 'error' in self.result.get() or '=' in self.result.get():
127 | self.result.delete(0,"end")
128 | self.result.insert("end","5")
129 | else:
130 | self.result.insert("end","5")
131 |
132 | def four(self):
133 | if 'error' in self.result.get() or '=' in self.result.get():
134 | self.result.delete(0,"end")
135 | self.result.insert("end","4")
136 | else:
137 | self.result.insert("end","4")
138 |
139 | def three(self):
140 | if 'error' in self.result.get() or '=' in self.result.get():
141 | self.result.delete(0,"end")
142 | self.result.insert("end","3")
143 | else:
144 | self.result.insert("end","3")
145 |
146 | def two(self):
147 | if 'error' in self.result.get() or '=' in self.result.get():
148 | self.result.delete(0,"end")
149 | self.result.insert("end","2")
150 | else:
151 | self.result.insert("end","2")
152 |
153 | def one(self):
154 | if 'error' in self.result.get() or '=' in self.result.get():
155 | self.result.delete(0,"end")
156 | self.result.insert("end","1")
157 | else:
158 | self.result.insert("end","1")
159 |
160 | def zero(self):
161 | if 'error' in self.result.get() or '=' in self.result.get():
162 | self.result.delete(0,"end")
163 | self.result.insert("end","0")
164 | else:
165 | self.result.insert("end","0")
166 |
167 | def plus(self):
168 | if 'error' in self.result.get() or '=' in self.result.get():
169 | self.result.delete(0,"end")
170 | self.result.insert("end","+")
171 | else:
172 | self.result.insert("end","+")
173 |
174 | def minus(self):
175 | if 'error' in self.result.get() or '=' in self.result.get():
176 | self.result.delete(0,"end")
177 | self.result.insert("end","-")
178 | else:
179 | self.result.insert("end","-")
180 |
181 | def mul(self):
182 | if 'error' in self.result.get() or '=' in self.result.get():
183 | self.result.delete(0,"end")
184 | self.result.insert("end","*")
185 | else:
186 | self.result.insert("end","*")
187 |
188 | def divide(self):
189 | if 'error' in self.result.get() or '=' in self.result.get():
190 | self.result.delete(0,"end")
191 | self.result.insert("end","/")
192 | else:
193 | self.result.insert("end","/")
194 |
195 | def equal(self):
196 |
197 |
198 | if self.result.get() == "":
199 | self.result.insert("end","error")
200 | elif self.result.get()[0] == "0" or self.result.get()[0] == "+" or self.result.get()[0] == "*" or self.result.get()[0] == "/":
201 | self.result.delete(0,"end")
202 | self.result.insert("end","error")
203 | elif 'error' in self.result.get() or '=' in self.result.get():
204 | self.result.delete(0,"end")
205 |
206 |
207 | else:
208 | self.res = self.result.get()
209 | self.res = eval(self.res)
210 | self.result.insert("end"," = ")
211 | self.result.insert("end",self.res)
212 |
213 | # =================== Clear Fields ===============
214 | def clear(self):
215 | self.result.delete(0,"end")
216 | def Clear(self):
217 | self.tea_item.delete(0,"end")
218 | self.coffee_item.delete(0,"end")
219 | self.sandwitch_item.delete(0,"end")
220 | self.burger_item.delete(0,"end")
221 | self.cake_item.delete(0,"end")
222 | self.fries_item.delete(0,"end")
223 | self.pizza_item.delete(0,"end")
224 | self.pepsi_item.delete(0,"end")
225 | self.items_cost.delete(0,"end")
226 | self.service_cost.delete(0,"end")
227 | self.sub_cost.delete(0,"end")
228 | self.paid_tax.delete(0,"end")
229 | self.total_bill.delete(0,"end")
230 |
231 |
232 | # ==== Exit button code =================
233 | def Quit(self):
234 | self.message = messagebox.askquestion('Exit',"Do you want to exit the application")
235 | if self.message == "yes":
236 | self.root.destroy()
237 | else:
238 | "return"
239 |
240 | #========== end ========================
241 |
242 |
243 | def __init__(self):
244 | self.root = tk.Tk()
245 | self.root.geometry('500x300')
246 | self.root.title("Cafe Management System")
247 | self.root.maxsize(500,300)
248 | self.root.minsize(500,300)
249 | self.root['bg'] = "white"
250 |
251 | self.heading = Label(self.root,text="Cafe Management System",font=('verdana',20,'bold'),fg="#248aa2",bg="white")
252 | self.heading.place(x=60,y=5)
253 |
254 | self.style1 = Label(self.root,bg="#248aa2",height=1,width=17)
255 | self.style1.place(x=0,y=50)
256 | self.style2 = Label(self.root,bg="#248aa2",height=1,width=30)
257 | self.style2.place(x=380,y=50)
258 | self.date = Label(self.root,text=datetime.now(),font=('verdana',10,'bold'),bg="white")
259 | self.date.place(x=140,y=50)
260 |
261 | self.cafe_icon = ImageTk.PhotoImage(Image.open('cafe.png'))
262 | self.logo = Label(self.root,image=self.cafe_icon,bg="white")
263 | self.logo.place(x=230,y=70)
264 |
265 | # ================== Items ===================
266 | self.frame1 = LabelFrame(self.root,text="Cafe Items",width=150,height=200,font=('verdana',10,'bold'),borderwidth=3,relief=RIDGE,highlightthickness=4,bg="white",highlightcolor="white",highlightbackground="white",fg="#248aa2")
267 | self.frame1.place(x=30,y=90)
268 |
269 | self.tea = Label(self.frame1,text="Tea",font=('verdana',10,'bold'),bg="white")
270 | self.tea.place(x=3,y=1)
271 | self.tea_item = Entry(self.frame1,width=7,borderwidth=4,relief=SUNKEN,bg="#248aa2")
272 | self.tea_item.place(y=1,x=85)
273 |
274 | self.coffee = Label(self.frame1,text="Coffee",font=('verdana',10,'bold'),bg="white")
275 | self.coffee.place(x=3,y=20)
276 | self.coffee_item = Entry(self.frame1,width=7,borderwidth=4,relief=SUNKEN,bg="#248aa2")
277 | self.coffee_item.place(y=20,x=85)
278 |
279 | self.sandwitch = Label(self.frame1,text="Sandwitch",font=('verdana',10,'bold'),bg="white")
280 | self.sandwitch.place(x=3,y=40)
281 | self.sandwitch_item = Entry(self.frame1,width=7,borderwidth=4,relief=SUNKEN,bg="#248aa2")
282 | self.sandwitch_item.place(y=40,x=85)
283 |
284 | self.cake = Label(self.frame1,text="Cake",font=('verdana',10,'bold'),bg="white")
285 | self.cake.place(x=3,y=60)
286 | self.cake_item = Entry(self.frame1,width=7,borderwidth=4,relief=SUNKEN,bg="#248aa2")
287 | self.cake_item.place(y=60,x=85)
288 |
289 | self.burger = Label(self.frame1,text="Burger",font=('verdana',10,'bold'),bg="white")
290 | self.burger.place(x=3,y=80)
291 | self.burger_item = Entry(self.frame1,width=7,borderwidth=4,relief=SUNKEN,bg="#248aa2")
292 | self.burger_item.place(y=80,x=85)
293 |
294 | self.pizza = Label(self.frame1,text="Pizza",font=('verdana',10,'bold'),bg="white")
295 | self.pizza.place(x=3,y=100)
296 | self.pizza_item = Entry(self.frame1,width=7,borderwidth=4,relief=SUNKEN,bg="#248aa2")
297 | self.pizza_item.place(y=100,x=85)
298 |
299 | self.fries = Label(self.frame1,text="Fries",font=('verdana',10,'bold'),bg="white")
300 | self.fries.place(x=3,y=120)
301 | self.fries_item = Entry(self.frame1,width=7,borderwidth=4,relief=SUNKEN,bg="#248aa2")
302 | self.fries_item.place(y=120,x=85)
303 |
304 | self.pepsi = Label(self.frame1,text="Pepsi",font=('verdana',10,'bold'),bg="white")
305 | self.pepsi.place(x=3,y=140)
306 | self.pepsi_item = Entry(self.frame1,width=7,borderwidth=4,relief=SUNKEN,bg="#248aa2")
307 | self.pepsi_item.place(y=140,x=85)
308 |
309 | # ============ Items Bill =================
310 |
311 | self.frame2 = LabelFrame(self.root,text="Cafe Items Bills",width=180,height=160,font=('verdana',10,'bold'),borderwidth=3,relief=RIDGE,highlightthickness=4,bg="white",highlightcolor="white",highlightbackground="white",fg="#248aa2")
312 | self.frame2.place(x=180,y=120)
313 |
314 | self.item_cost_lb = Label(self.frame2,text="Items Cost",font=('verdana',10,'bold'),bg="white")
315 | self.item_cost_lb.place(x=3,y=1)
316 | self.items_cost = Entry(self.frame2,width=9,borderwidth=4,relief=SUNKEN,bg="#248aa2")
317 | self.items_cost.place(y=1,x=100)
318 |
319 | self.service_cost_lb = Label(self.frame2,text="Service Cost",font=('verdana',10,'bold'),bg="white")
320 | self.service_cost_lb.place(x=3,y=20)
321 | self.service_cost = Entry(self.frame2,width=9,borderwidth=4,relief=SUNKEN,bg="#248aa2")
322 | self.service_cost.place(y=20,x=100)
323 |
324 | self.sub_cost_lb = Label(self.frame2,text="Sub Cost",font=('verdana',10,'bold'),bg="white")
325 | self.sub_cost_lb.place(x=3,y=40)
326 | self.sub_cost = Entry(self.frame2,width=9,borderwidth=4,relief=SUNKEN,bg="#248aa2")
327 | self.sub_cost.place(y=40,x=100)
328 |
329 | self.paid_tax_lb = Label(self.frame2,text="Paid Tax",font=('verdana',10,'bold'),bg="white")
330 | self.paid_tax_lb.place(x=3,y=80)
331 | self.paid_tax = Entry(self.frame2,width=9,borderwidth=4,relief=SUNKEN,bg="#248aa2")
332 | self.paid_tax.place(y=80,x=100)
333 |
334 | self.total_bill_lb = Label(self.frame2,text="Total Bill",font=('verdana',10,'bold'),bg="white")
335 | self.total_bill_lb.place(x=3,y=100)
336 | self.total_bill = Entry(self.frame2,width=9,borderwidth=4,relief=SUNKEN,bg="#248aa2")
337 | self.total_bill.place(y=100,x=100)
338 |
339 | # ================== Calculator ============
340 | self.frame3 = LabelFrame(self.root,text="Calculator",font=('verdana',10,'bold'),fg="#248aa2",bg="white",highlightbackground="white",width=135,height=150,borderwidth=3,relief=RIDGE)
341 | self.frame3.place(x=360,y=90)
342 |
343 | self.result = Entry(self.frame3,width=19,relief=SUNKEN,borderwidth=3)
344 | self.result.place(x=2,y=0)
345 |
346 | self.nine = Button(self.frame3,text="9",padx=6,relief=RAISED,borderwidth=2,font=('verdana',10,'bold'),bg='#248aa2',fg="white",command=self.nine)
347 | self.nine.place(x=0,y=24)
348 | self.eight = Button(self.frame3,text="8",padx=6,relief=RAISED,borderwidth=2,font=('verdana',10,'bold'),bg='#248aa2',fg="white",command=self.eight)
349 | self.eight.place(x=32,y=24)
350 | self.seven = Button(self.frame3,text="7",padx=6,relief=RAISED,borderwidth=2,font=('verdana',10,'bold'),bg='#248aa2',fg="white",command=self.seven)
351 | self.seven.place(x=64,y=24)
352 | self.plus = Button(self.frame3,text="+",padx=6,relief=RAISED,borderwidth=2,font=('verdana',10,'bold'),bg='white',fg="black",command=self.plus)
353 | self.plus.place(x=96,y=24)
354 |
355 |
356 | self.six = Button(self.frame3,text="6",padx=6,relief=RAISED,borderwidth=2,font=('verdana',10,'bold'),bg='#248aa2',fg="white",command=self.six)
357 | self.six.place(x=0,y=50)
358 | self.five = Button(self.frame3,text="5",padx=6,relief=RAISED,borderwidth=2,font=('verdana',10,'bold'),bg='#248aa2',fg="white",command=self.five)
359 | self.five.place(x=32,y=50)
360 | self.four = Button(self.frame3,text="4",padx=6,relief=RAISED,borderwidth=2,font=('verdana',10,'bold'),bg='#248aa2',fg="white",command=self.four)
361 | self.four.place(x=64,y=50)
362 | self.minus = Button(self.frame3,text="-",padx=8,relief=RAISED,borderwidth=2,font=('verdana',10,'bold'),bg='white',fg="black",command=self.minus)
363 | self.minus.place(x=96,y=50)
364 |
365 | self.three = Button(self.frame3,text="3",padx=6,relief=RAISED,borderwidth=2,font=('verdana',10,'bold'),bg='#248aa2',fg="white",command=self.three)
366 | self.three.place(x=0,y=76)
367 | self.two = Button(self.frame3,text="2",padx=6,relief=RAISED,borderwidth=2,font=('verdana',10,'bold'),bg='#248aa2',fg="white",command=self.two)
368 | self.two.place(x=32,y=76)
369 | self.one = Button(self.frame3,text="1",padx=6,relief=RAISED,borderwidth=2,font=('verdana',10,'bold'),bg='#248aa2',fg="white",command=self.one)
370 | self.one.place(x=64,y=76)
371 | self.multiply = Button(self.frame3,text="*",padx=7,relief=RAISED,borderwidth=2,font=('verdana',10,'bold'),bg='white',fg="black",command=self.mul)
372 | self.multiply.place(x=96,y=76)
373 |
374 | self.zero = Button(self.frame3,text="0",padx=6,relief=RAISED,borderwidth=2,font=('verdana',10,'bold'),bg='#248aa2',fg="white",command=self.zero)
375 | self.zero.place(x=0,y=102)
376 | self.clear = Button(self.frame3,text="C",padx=6,relief=RAISED,borderwidth=2,font=('verdana',10,'bold'),bg='#248aa2',fg="white",command=self.clear)
377 | self.clear.place(x=32,y=102)
378 | self.equal = Button(self.frame3,text="=",padx=6,relief=RAISED,borderwidth=2,font=('verdana',10,'bold'),bg='#248aa2',fg="white",command=self.equal)
379 | self.equal.place(x=64,y=102)
380 | self.divide = Button(self.frame3,text="/",padx=7,relief=RAISED,borderwidth=2,font=('verdana',10,'bold'),bg='white',fg="black",command=self.divide)
381 | self.divide.place(x=96,y=102)
382 |
383 | self.Total_Bills_btn = Button(self.root,text="Total",relief=RAISED,borderwidth=2,font=('verdana',10,'bold'),bg='#248aa2',fg="white",command=self.Total_Bill)
384 | self.Total_Bills_btn.place(x=360,y=245)
385 |
386 | self.Clear_btn = Button(self.root,text="Clear",relief=RAISED,borderwidth=2,font=('verdana',10,'bold'),bg='#248aa2',fg="white",command=self.Clear)
387 | self.Clear_btn.place(x=410,y=245)
388 |
389 | self.icon = ImageTk.PhotoImage(Image.open('false.png'))
390 | self.Quit_btn = Button(self.root,image=self.icon,relief=RAISED,borderwidth=2,font=('verdana',10,'bold'),bg='#248aa2',fg="white",padx=5,command=self.Quit)
391 | self.Quit_btn.place(x=463,y=245)
392 |
393 | self.root.mainloop()
394 |
395 |
396 | if __name__ == '__main__':
397 | cafe_management()
398 |
399 |
400 |
401 |
--------------------------------------------------------------------------------
/Billing System/billing_system.py:
--------------------------------------------------------------------------------
1 | from tkinter import*
2 | import random
3 | import os
4 | from tkinter import messagebox
5 |
6 |
7 | #===============main=====================
8 | class Bill_App:
9 | def __init__(self, root):
10 | self.root = root
11 | self.root.geometry("1350x700+0+0")
12 | self.root.title("Billing Software")
13 | bg_color = "#badc57"
14 | title = Label(self.root, text="Billing Software", font=('times new roman', 30, 'bold'), pady=2, bd=12, bg="#badc57", fg="Black", relief=GROOVE)
15 | title.pack(fill=X)
16 | # ================variables=======================
17 | self.sanitizer = IntVar()
18 | self.mask = IntVar()
19 | self.hand_gloves = IntVar()
20 | self.syrup = IntVar()
21 | self.cream = IntVar()
22 | self.thermal_gun = IntVar()
23 | # ============grocery==============================
24 | self.rice = IntVar()
25 | self.food_oil = IntVar()
26 | self.wheat = IntVar()
27 | self.spices = IntVar()
28 | self.flour = IntVar()
29 | self.maggi = IntVar()
30 | #=============coldDrinks=============================
31 | self.sprite = IntVar()
32 | self.mineral = IntVar()
33 | self.juice = IntVar()
34 | self.coke = IntVar()
35 | self.lassi = IntVar()
36 | self.mountain_duo = IntVar()
37 | # ==============Total product price================
38 | self.medical_price = StringVar()
39 | self.grocery_price = StringVar()
40 | self.cold_drinks_price = StringVar()
41 | # ==============Customer==========================
42 | self.c_name = StringVar()
43 | self.c_phone = StringVar()
44 | self.bill_no = StringVar()
45 | x = random.randint(1000, 9999)
46 | self.bill_no.set(str(x))
47 | self.search_bill = StringVar()
48 | # ===============Tax================================
49 | self.medical_tax = StringVar()
50 | self.grocery_tax = StringVar()
51 | self.cold_drinks_tax = StringVar()
52 | # =============customer retail details======================
53 | F1 = LabelFrame(self.root, text="Customer Details", font=('times new roman', 15, 'bold'), bd=10, fg="Black", bg="#badc57")
54 | F1.place(x=0, y=80, relwidth=1)
55 |
56 | cname_lbl = Label(F1, text="Customer Name:", bg=bg_color, font=('times new roman', 15, 'bold'))
57 | cname_lbl.grid(row=0, column=0, padx=20, pady=5)
58 | cname_txt = Entry(F1, width=15, textvariable=self.c_name, font='arial 15', bd=7, relief=GROOVE)
59 | cname_txt.grid(row=0, column=1, pady=5, padx=10)
60 |
61 | cphn_lbl = Label(F1, text="Customer Phone:", bg="#badc57", font=('times new roman', 15, 'bold'))
62 | cphn_lbl.grid(row=0, column=2, padx=20, pady=5)
63 | cphn_txt = Entry(F1, width=15, textvariable=self.c_phone, font='arial 15', bd=7, relief=GROOVE)
64 | cphn_txt.grid(row=0, column=3, pady=5, padx=10)
65 |
66 | c_bill_lbl = Label(F1, text="Bill Number:", bg="#badc57", font=('times new roman', 15, 'bold'))
67 | c_bill_lbl.grid(row=0, column=4, padx=20, pady=5)
68 | c_bill_txt = Entry(F1, width=15, textvariable=self.search_bill, font='arial 15', bd=7, relief=GROOVE)
69 | c_bill_txt.grid(row=0, column=5, pady=5, padx=10)
70 |
71 | bil_btn = Button(F1, text="Search", command=self.find_bill, width=10, bd=7, font=('arial', 12, 'bold'), relief=GROOVE)
72 | bil_btn.grid(row=0, column=6, pady=5, padx=10)
73 |
74 | # ===================Medical====================================
75 | F2 = LabelFrame(self.root, text="Medical Purpose", font=('times new roman', 15, 'bold'), bd=10, fg="Black", bg="#badc57")
76 | F2.place(x=5, y=180, width=325, height=380)
77 |
78 | sanitizer_lbl = Label(F2, text="Sanitizer", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black")
79 | sanitizer_lbl.grid(row=0, column=0, padx=10, pady=10, sticky='W')
80 | sanitizer_txt = Entry(F2, width=10, textvariable=self.sanitizer, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE)
81 | sanitizer_txt.grid(row=0, column=1, padx=10, pady=10)
82 |
83 | mask_lbl = Label(F2, text="Mask", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black")
84 | mask_lbl.grid(row=1, column=0, padx=10, pady=10, sticky='W')
85 | mask_txt = Entry(F2, width=10, textvariable=self.mask, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE)
86 | mask_txt.grid(row=1, column=1, padx=10, pady=10)
87 |
88 | hand_gloves_lbl = Label(F2, text="Hand Gloves", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black")
89 | hand_gloves_lbl.grid(row=2, column=0, padx=10, pady=10, sticky='W')
90 | hand_gloves_txt = Entry(F2, width=10, textvariable=self.hand_gloves, font=('times new roman', 16, 'bold'), bd=5, relief =GROOVE)
91 | hand_gloves_txt.grid(row=2, column=1, padx=10, pady=10)
92 |
93 | syrup_lbl = Label(F2, text="Syrup", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black")
94 | syrup_lbl.grid(row=3, column=0, padx=10, pady=10, sticky='W')
95 | syrup_txt = Entry(F2, width=10, textvariable=self.syrup, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE)
96 | syrup_txt.grid(row=3, column=1, padx=10, pady=10)
97 |
98 | cream_lbl = Label(F2, text="Cream", font=('times new roman', 16, 'bold'), bg = "#badc57", fg = "black")
99 | cream_lbl.grid(row=4, column=0, padx=10, pady=10, sticky='W')
100 | cream_txt = Entry(F2, width=10, textvariable=self.cream, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE)
101 | cream_txt.grid(row=4, column=1, padx=10, pady=10)
102 |
103 | thermal_gun_lbl = Label(F2, text="Thermal Gun", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black")
104 | thermal_gun_lbl.grid(row=5, column=0, padx=10, pady=10, sticky='W')
105 | thermal_gun_txt = Entry(F2, width=10, textvariable=self.thermal_gun, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE)
106 | thermal_gun_txt.grid(row=5, column=1, padx=10, pady=10)
107 |
108 | # ==========GroceryItems=========================
109 | F3 = LabelFrame(self.root, text="Grocery Items", font=('times new roman', 15, 'bold'), bd=10, fg="Black", bg="#badc57")
110 | F3.place(x=340, y=180, width=325, height=380)
111 |
112 | rice_lbl = Label(F3, text="Rice", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black")
113 | rice_lbl.grid(row=0, column=0, padx=10, pady=10, sticky='W')
114 | rice_txt = Entry(F3, width=10, textvariable=self.rice, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE)
115 | rice_txt.grid(row=0, column=1, padx=10, pady=10)
116 |
117 | food_oil_lbl = Label(F3, text="Food Oil", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black")
118 | food_oil_lbl.grid(row=1, column=0, padx=10, pady=10, sticky='W')
119 | food_oil_txt = Entry(F3, width=10, textvariable=self.food_oil, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE)
120 | food_oil_txt.grid(row=1, column=1, padx=10, pady=10)
121 |
122 | wheat_lbl = Label(F3, text="Wheat", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black")
123 | wheat_lbl.grid(row=2, column=0, padx=10, pady=10, sticky='W')
124 | wheat_txt = Entry(F3, width=10, textvariable=self.wheat, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE)
125 | wheat_txt.grid(row=2, column=1, padx=10, pady=10)
126 |
127 | spices_lbl = Label(F3, text="Spices", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black")
128 | spices_lbl.grid(row=3, column=0, padx=10, pady=10, sticky='W')
129 | spices_txt = Entry(F3, width=10, textvariable=self.spices, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE)
130 | spices_txt.grid(row=3, column=1, padx=10, pady=10)
131 |
132 | flour_lbl = Label(F3, text="Flour", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black")
133 | flour_lbl.grid(row=4, column=0, padx=10, pady=10, sticky='W')
134 | flour_txt = Entry(F3, width=10, textvariable=self.flour, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE)
135 | flour_txt.grid(row=4, column=1, padx=10, pady=10)
136 |
137 | maggi_lbl = Label(F3, text="Maggi", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black")
138 | maggi_lbl.grid(row=5, column=0, padx=10, pady=10, sticky='W')
139 | maggi_txt = Entry(F3, width=10, textvariable=self.maggi, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE)
140 | maggi_txt.grid(row=5, column=1, padx=10, pady=10)
141 |
142 | # ===========ColdDrinks================================
143 | F4 = LabelFrame(self.root, text="Cold Drinks", font=('times new roman', 15, 'bold'), bd=10, fg="Black", bg="#badc57")
144 | F4.place(x=670, y=180, width=325, height=380)
145 |
146 | sprite_lbl = Label(F4, text="Sprite", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black")
147 | sprite_lbl.grid(row=0, column=0, padx=10, pady=10, sticky='W')
148 | sprite_txt = Entry(F4, width=10, textvariable=self.sprite, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE)
149 | sprite_txt.grid(row=0, column=1, padx=10, pady=10)
150 |
151 | mineral_lbl = Label(F4, text="Mineral Water", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black")
152 | mineral_lbl.grid(row=1, column=0, padx=10, pady=10, sticky='W')
153 | mineral_txt = Entry(F4, width=10, textvariable=self.mineral, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE)
154 | mineral_txt.grid(row=1, column=1, padx=10, pady=10)
155 |
156 | juice_lbl = Label(F4, text="Juice", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black")
157 | juice_lbl.grid(row=2, column=0, padx=10, pady=10, sticky='W')
158 | juice_txt = Entry(F4, width=10, textvariable=self.juice, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE)
159 | juice_txt.grid(row=2, column=1, padx=10, pady=10)
160 |
161 | coke_lbl = Label(F4, text="Coke", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black")
162 | coke_lbl.grid(row=3, column=0, padx=10, pady=10, sticky='W')
163 | coke_txt = Entry(F4, width=10, textvariable=self.coke, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE)
164 | coke_txt.grid(row=3, column=1, padx=10, pady=10)
165 |
166 | lassi_lbl = Label(F4, text="Lassi", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black")
167 | lassi_lbl.grid(row=4, column=0, padx=10, pady=10, sticky='W')
168 | lassi_txt = Entry(F4, width=10, textvariable=self.lassi, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE)
169 | lassi_txt.grid(row=4, column=1, padx=10, pady=10)
170 |
171 | mountain_duo_lbl = Label(F4, text="Mountain Duo", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black")
172 | mountain_duo_lbl.grid(row=5, column=0, padx=10, pady=10, sticky='W')
173 | mountain_duo_txt = Entry(F4, width=10, textvariable=self.mountain_duo, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE)
174 | mountain_duo_txt.grid(row=5, column=1, padx=10, pady=10)
175 |
176 | # =================BillArea======================
177 | F5 = Frame(self.root, bd=10, relief=GROOVE)
178 | F5.place(x=1010, y=180, width=350, height=380)
179 |
180 | bill_title = Label(F5, text="Bill Area", font='arial 15 bold', bd=7, relief=GROOVE)
181 | bill_title.pack(fill=X)
182 | scroll_y = Scrollbar(F5, orient=VERTICAL)
183 | self.txtarea = Text(F5, yscrollcommand=scroll_y.set)
184 | scroll_y.pack(side=RIGHT, fill=Y)
185 | scroll_y.config(command=self.txtarea.yview)
186 | self.txtarea.pack(fill=BOTH, expand=1)
187 |
188 | # =======================ButtonFrame=============
189 | F6 = LabelFrame(self.root, text="Bill Area", font=('times new roman', 14, 'bold'), bd=10, fg="Black", bg="#badc57")
190 | F6.place(x=0, y=560, relwidth=1, height=140)
191 |
192 | m1_lbl = Label(F6, text="Total Medical Price", font=('times new roman', 14, 'bold'), bg="#badc57", fg="black")
193 | m1_lbl.grid(row=0, column=0, padx=20, pady=1, sticky='W')
194 | m1_txt = Entry(F6, width=18, textvariable=self.medical_price, font='arial 10 bold', bd=7, relief=GROOVE)
195 | m1_txt.grid(row=0, column=1, padx=18, pady=1)
196 |
197 | m2_lbl = Label(F6, text="Total Grocery Price", font=('times new roman', 14, 'bold'), bg="#badc57", fg="black")
198 | m2_lbl.grid(row=1, column=0, padx=20, pady=1, sticky='W')
199 | m2_txt = Entry(F6, width=18, textvariable=self.grocery_price, font='arial 10 bold', bd=7, relief=GROOVE)
200 | m2_txt.grid(row=1, column=1, padx=18, pady=1)
201 |
202 | m3_lbl = Label(F6, text="Total Cold Drinks Price", font=('times new roman', 14, 'bold'), bg="#badc57", fg="black")
203 | m3_lbl.grid(row=2, column=0, padx=20, pady=1, sticky='W')
204 | m3_txt = Entry(F6, width=18, textvariable=self.cold_drinks_price, font='arial 10 bold', bd=7, relief=GROOVE)
205 | m3_txt.grid(row=2, column=1, padx=18, pady=1)
206 |
207 | m4_lbl = Label(F6, text="Medical Tax", font=('times new roman', 14, 'bold'), bg="#badc57", fg="black")
208 | m4_lbl.grid(row=0, column=2, padx=20, pady=1, sticky='W')
209 | m4_txt = Entry(F6, width=18, textvariable=self.medical_tax, font='arial 10 bold', bd=7, relief=GROOVE)
210 | m4_txt.grid(row=0, column=3, padx=18, pady=1)
211 |
212 | m5_lbl = Label(F6, text="Grocery Tax", font=('times new roman', 14, 'bold'), bg="#badc57", fg="black")
213 | m5_lbl.grid(row=1, column=2, padx=20, pady=1, sticky='W')
214 | m5_txt = Entry(F6, width=18, textvariable=self.grocery_tax, font='arial 10 bold', bd=7, relief=GROOVE)
215 | m5_txt.grid(row=1, column=3, padx=18, pady=1)
216 |
217 | m6_lbl = Label(F6, text="Cold Drinks Tax", font=('times new roman', 14, 'bold'), bg="#badc57", fg="black")
218 | m6_lbl.grid(row=2, column=2, padx=20, pady=1, sticky='W')
219 | m6_txt = Entry(F6, width=18, textvariable=self.cold_drinks_tax, font='arial 10 bold', bd=7, relief=GROOVE)
220 | m6_txt.grid(row=2, column=3, padx=18, pady=1)
221 |
222 | # =======Buttons-======================================
223 | btn_f = Frame(F6, bd=7, relief=GROOVE)
224 | btn_f.place(x=760, width=580, height=105)
225 |
226 | total_btn = Button(btn_f, command=self.total, text="Total", bg="#535C68", bd=2, fg="white", pady=15, width=12, font='arial 13 bold')
227 | total_btn.grid(row=0, column=0, padx=5, pady=5)
228 |
229 | generateBill_btn = Button(btn_f, command=self.bill_area, text="Generate Bill", bd=2, bg="#535C68", fg="white", pady=12, width=12, font='arial 13 bold')
230 | generateBill_btn.grid(row=0, column=1, padx=5, pady=5)
231 |
232 | clear_btn = Button(btn_f, command=self.clear_data, text="Clear", bg="#535C68", bd=2, fg="white", pady=15, width=12, font='arial 13 bold')
233 | clear_btn.grid(row=0, column=2, padx=5, pady=5)
234 |
235 | exit_btn = Button(btn_f, command=self.exit_app, text="Exit", bd=2, bg="#535C68", fg="white", pady=15, width=12, font='arial 13 bold')
236 | exit_btn.grid(row=0, column=3, padx=5, pady=5)
237 | self.welcome_bill()
238 |
239 |
240 | def total(self):
241 | self.m_h_g_p = self.hand_gloves.get()*12
242 | self.m_s_p = self.sanitizer.get()*2
243 | self.m_m_p = self.mask.get()*5
244 | self.m_s_p = self.syrup.get()*30
245 | self.m_c_p = self.cream.get()*5
246 | self.m_t_g_p = self.thermal_gun.get()*15
247 | self.total_medical_price = float(self.m_m_p+self.m_h_g_p+self.m_s_p+self.m_c_p+self.m_t_g_p+self.m_s_p)
248 |
249 | self.medical_price.set("Rs. "+str(self.total_medical_price))
250 | self.c_tax = round((self.total_medical_price*0.05), 2)
251 | self.medical_tax.set("Rs. "+str(self.c_tax))
252 |
253 | self.g_r_p = self.rice.get()*10
254 | self.g_f_o_p = self.food_oil.get()*10
255 | self.g_w_p = self.wheat.get()*10
256 | self.g_s_p = self.spices.get()*6
257 | self.g_f_p = self.flour.get()*8
258 | self.g_m_p = self.maggi.get()*5
259 | self.total_grocery_price = float(self.g_r_p+self.g_f_o_p+self.g_w_p+self.g_s_p+self.g_f_p+self.g_m_p)
260 |
261 | self.grocery_price.set("Rs. " + str(self.total_grocery_price))
262 | self.g_tax = round((self.total_grocery_price*5), 2)
263 | self.grocery_tax.set("Rs. " + str(self.g_tax))
264 |
265 | self.c_d_s_p = self.sprite.get()*10
266 | self.c_d_w_p = self.mineral.get()*10
267 | self.c_d_j_p = self.juice.get()*10
268 | self.c_d_c_p = self.coke.get()*10
269 | self.c_d_l_p = self.lassi.get()*10
270 | self.c_m_d = self.mountain_duo.get()*10
271 | self.total_cold_drinks_price = float(self.c_d_s_p+self.c_d_w_p+self.c_d_j_p+self.c_d_c_p+self.c_d_l_p+self.c_m_d)
272 |
273 | self.cold_drinks_price.set("Rs. "+str(self.total_cold_drinks_price))
274 | self.c_d_tax = round((self.total_cold_drinks_price * 0.1), 2)
275 | self.cold_drinks_tax.set("Rs. "+str(self.c_d_tax))
276 |
277 | self.total_bill = float(self.total_medical_price+self.total_grocery_price+self.total_cold_drinks_price+self.c_tax+self.g_tax+self.c_d_tax)
278 |
279 | def welcome_bill(self):
280 | self.txtarea.delete('1.0', END)
281 | self.txtarea.insert(END, "\tWelcome Grocery Retail")
282 | self.txtarea.insert(END, f"\nBill Number:{self.bill_no.get()}")
283 | self.txtarea.insert(END, f"\nCustomer Name:{self.c_name.get()}")
284 | self.txtarea.insert(END, f"\nPhone Number{self.c_phone.get()}")
285 | self.txtarea.insert(END, f"\n================================")
286 | self.txtarea.insert(END, f"\nProducts\t\tQTY\t\tPrice")
287 |
288 | def bill_area(self):
289 | if self.c_name.get() == " " or self.c_phone.get() == " ":
290 | messagebox.showerror("Error", "Customer Details Are Must")
291 | elif self.medical_price.get() == "Rs. 0.0" and self.grocery_price.get() == "Rs. 0.0" and self.cold_drinks_price.get()=="Rs. 0.0":
292 | messagebox.showerror("Error", "No Product Purchased")
293 | else:
294 | self.welcome_bill()
295 | # ============medical===========================
296 | if self.sanitizer.get() != 0:
297 | self.txtarea.insert(END, f"\n Sanitizer\t\t{self.sanitizer.get()}\t\t{self.m_s_p}")
298 | if self.mask.get() != 0:
299 | self.txtarea.insert(END, f"\n Mask\t\t{self.mask.get()}\t\t{self.m_m_p}")
300 | if self.hand_gloves.get() != 0:
301 | self.txtarea.insert(END, f"\n Hand Gloves\t\t{self.hand_gloves.get()}\t\t{self.m_h_g_p}")
302 | if self.syrup.get() != 0:
303 | self.txtarea.insert(END, f"\n Syrup\t\t{self.syrup.get()}\t\t{self.m_s_p}")
304 | if self.cream.get() != 0:
305 | self.txtarea.insert(END, f"\n Cream\t\t{self.cream.get()}\t\t{self.m_c_p}")
306 | if self.thermal_gun.get() != 0:
307 | self.txtarea.insert(END, f"\n Thermal Gun\t\t{self.sanitizer.get()}\t\t{self.m_t_g_p}")
308 | # ==============Grocery============================
309 | if self.rice.get() != 0:
310 | self.txtarea.insert(END, f"\n Rice\t\t{self.rice.get()}\t\t{self.g_r_p}")
311 | if self.food_oil.get() != 0:
312 | self.txtarea.insert(END, f"\n Food Oil\t\t{self.food_oil.get()}\t\t{self.g_f_o_p}")
313 | if self.wheat.get() != 0:
314 | self.txtarea.insert(END, f"\n Wheat\t\t{self.wheat.get()}\t\t{self.g_w_p}")
315 | if self.spices.get() != 0:
316 | self.txtarea.insert(END, f"\n Spices\t\t{self.spices.get()}\t\t{self.g_s_p}")
317 | if self.flour.get() != 0:
318 | self.txtarea.insert(END, f"\n Flour\t\t{self.flour.get()}\t\t{self.g_f_p}")
319 | if self.maggi.get() != 0:
320 | self.txtarea.insert(END, f"\n Maggi\t\t{self.maggi.get()}\t\t{self.g_m_p}")
321 | #================ColdDrinks==========================
322 | if self.sprite.get() != 0:
323 | self.txtarea.insert(END, f"\n Sprite\t\t{self.sprite.get()}\t\t{self.c_d_s_p}")
324 | if self.mineral.get() != 0:
325 | self.txtarea.insert(END, f"\n Mineral\t\t{self.mineral.get()}\t\t{self.c_d_w_p}")
326 | if self.juice.get() != 0:
327 | self.txtarea.insert(END, f"\n Juice\t\t{self.juice.get()}\t\t{self.c_d_j_p}")
328 | if self.coke.get() != 0:
329 | self.txtarea.insert(END, f"\n Coke\t\t{self.coke.get()}\t\t{self.c_d_c_p}")
330 | if self.lassi.get() != 0:
331 | self.txtarea.insert(END, f"\n Lassi\t\t{self.cream.get()}\t\t{self.c_d_l_p}")
332 | if self.mountain_duo.get() != 0:
333 | self.txtarea.insert(END, f"\n Mountain Duo\t\t{self.sanitizer.get()}\t\t{self.c_m_d}")
334 | self.txtarea.insert(END, f"\n--------------------------------")
335 | # ===============taxes==============================
336 | if self.medical_tax.get() != '0.0':
337 | self.txtarea.insert(END, f"\n Medical Tax\t\t\t{self.medical_tax.get()}")
338 | if self.grocery_tax.get() != '0.0':
339 | self.txtarea.insert(END, f"\n Grocery Tax\t\t\t{self.grocery_tax.get()}")
340 | if self.cold_drinks_tax.get() != '0.0':
341 | self.txtarea.insert(END, f"\n Cold Drinks Tax\t\t\t{self.cold_drinks_tax.get()}")
342 |
343 | self.txtarea.insert(END, f"\n Total Bil:\t\t\t Rs.{self.total_bill}")
344 | self.txtarea.insert(END, f"\n--------------------------------")
345 | self.save_bill()
346 |
347 | def save_bill(self):
348 | op = messagebox.askyesno("Save Bill", "Do you want to save the bill?")
349 | if op > 0:
350 | self.bill_data = self.txtarea.get('1.0', END)
351 | f1 = open("bills/"+str(self.bill_no.get())+".txt", "w")
352 | f1.write(self.bill_data)
353 | f1.close()
354 | messagebox.showinfo("Saved", f"Bill no:{self.bill_no.get()} Saved Successfully")
355 | else:
356 | return
357 |
358 | def find_bill(self):
359 | present = "no"
360 | for i in os.listdir("bills/"):
361 | if i.split('.')[0] == self.search_bill.get():
362 | f1 = open(f"bills/{i}", "r")
363 | self.txtarea.delete("1.0", END)
364 | for d in f1:
365 | self.txtarea.insert(END, d)
366 | f1.close()
367 | present = "yes"
368 | if present == "no":
369 | messagebox.showerror("Error", "Invalid Bill No")
370 |
371 | def clear_data(self):
372 | op = messagebox.askyesno("Clear", "Do you really want to Clear?")
373 | if op > 0:
374 | self.sanitizer.set(0)
375 | self.mask.set(0)
376 | self.hand_gloves.set(0)
377 | self.syrup.set(0)
378 | self.cream.set(0)
379 | self.thermal_gun.set(0)
380 | # ============grocery==============================
381 | self.rice.set(0)
382 | self.food_oil.set(0)
383 | self.wheat.set(0)
384 | self.spices.set(0)
385 | self.flour.set(0)
386 | self.maggi.set(0)
387 | # =============coldDrinks=============================
388 | self.sprite.set(0)
389 | self.mineral.set(0)
390 | self.juice.set(0)
391 | self.coke.set(0)
392 | self.lassi.set(0)
393 | self.mountain_duo.set(0)
394 | # ====================taxes================================
395 | self.medical_price.set("")
396 | self.grocery_price.set("")
397 | self.cold_drinks_price.set("")
398 |
399 | self.medical_tax.set("")
400 | self.grocery_tax.set("")
401 | self.cold_drinks_tax.set("")
402 |
403 | self.c_name.set("")
404 | self.c_phone.set("")
405 |
406 | self.bill_no.set("")
407 | x = random.randint(1000, 9999)
408 | self.bill_no.set(str(x))
409 |
410 | self.search_bill.set("")
411 | self.welcome_bill()
412 |
413 | def exit_app(self):
414 | op = messagebox.askyesno("Exit", "Do you really want to exit?")
415 | if op > 0:
416 | self.root.destroy()
417 |
418 |
419 | root = Tk()
420 | obj = Bill_App(root)
421 | root.mainloop()
422 |
423 |
424 |
--------------------------------------------------------------------------------