Skip to content

Commit 3b9c5ee

Browse files
committed
Machine Learning GUI Projects
0 parents  commit 3b9c5ee

File tree

7 files changed

+513
-0
lines changed

7 files changed

+513
-0
lines changed

Calender-GUI/Calender-GUI.ipynb

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"#Importing tkinter module\n",
10+
"from tkinter import *\n",
11+
"#importing calendar module\n",
12+
"import calendar"
13+
]
14+
},
15+
{
16+
"cell_type": "code",
17+
"execution_count": 2,
18+
"metadata": {},
19+
"outputs": [],
20+
"source": [
21+
"#function to show calendar of the given year\n",
22+
"def showCalender():\n",
23+
" gui = Tk()\n",
24+
" gui.config(background='grey')\n",
25+
" gui.title(\"Calender GUI\")\n",
26+
" gui.geometry(\"550x600\")\n",
27+
" year = int(year_field.get())\n",
28+
" gui_content= calendar.calendar(year)\n",
29+
" calYear = Label(gui, text= gui_content, font= \"Consolas 10 bold\")\n",
30+
" calYear.grid(row=5, column=1,padx=20)\n",
31+
" gui.mainloop()"
32+
]
33+
},
34+
{
35+
"cell_type": "code",
36+
"execution_count": null,
37+
"metadata": {},
38+
"outputs": [],
39+
"source": [
40+
"#Driver code\n",
41+
"if __name__=='__main__':\n",
42+
" new = Tk()\n",
43+
" new.config(background='grey')\n",
44+
" new.title(\"Calender\")\n",
45+
" new.geometry(\"250x140\")\n",
46+
" cal = Label(new, text=\"Calender\",bg='grey',font=(\"times\", 28, \"bold\"))\n",
47+
" year = Label(new, text=\"Enter year\", bg='dark grey')\n",
48+
" year_field=Entry(new)\n",
49+
" button = Button(new, text='Show Calender',\n",
50+
"fg='Black',bg='Blue',command=showCalender)\n",
51+
"\n",
52+
" #putting widgets in position\n",
53+
" cal.grid(row=1, column=1)\n",
54+
" year.grid(row=2, column=1)\n",
55+
" year_field.grid(row=3, column=1)\n",
56+
" button.grid(row=4, column=1)\n",
57+
" # Exit.grid(row=6, column=1)\n",
58+
" new.mainloop()"
59+
]
60+
}
61+
],
62+
"metadata": {
63+
"kernelspec": {
64+
"display_name": "Python 3",
65+
"language": "python",
66+
"name": "python3"
67+
},
68+
"language_info": {
69+
"codemirror_mode": {
70+
"name": "ipython",
71+
"version": 3
72+
},
73+
"file_extension": ".py",
74+
"mimetype": "text/x-python",
75+
"name": "python",
76+
"nbconvert_exporter": "python",
77+
"pygments_lexer": "ipython3",
78+
"version": "3.11.3"
79+
},
80+
"orig_nbformat": 4
81+
},
82+
"nbformat": 4,
83+
"nbformat_minor": 2
84+
}

Clock-GUI/clock.kv

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<label>:
2+
font_name: 'Roboto'
3+
font_size: 60
4+
markup: True
5+
<RobotoButton@Button>:
6+
background_normal: 'button_down.png'
7+
background_down: 'button_down.png'
8+
border: (2, 2, 2, 2)
9+
font_name: 'Roboto'
10+
font_size: 25
11+
bold: True
12+
13+
BoxLayout:
14+
orientation: 'vertical'
15+
16+
Label:
17+
id: time
18+
text: '[b]00[/b]:00:00'
19+
BoxLayout:
20+
height: 90
21+
orientation: 'horizontal'
22+
padding: 20
23+
spacing: 20
24+
size_hint: (1, 0)
25+
26+
RobotoButton:
27+
id: start_stop
28+
text: 'Start'
29+
on_press: app.start_stop()
30+
31+
RobotoButton:
32+
id: reset
33+
text: 'Reset'
34+
background_normal: 'red_button_normal.png'
35+
background_down: 'red_button_down.png'
36+
on_press: app.reset()
37+
Label:
38+
id: stopwatch
39+
text: '00:00.[size=40]00[/size]'

Clock-GUI/main.py

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
from time import strftime
2+
from kivy.app import App
3+
from kivy.clock import Clock
4+
from kivy.core.text import LabelBase
5+
from kivy.core.window import Window
6+
from kivy.utils import get_color_from_hex
7+
8+
class clockApp(App):
9+
sw_started= False
10+
sw_seconds = 0
11+
def update_time(self, nap):
12+
if self.sw_started:
13+
self.sw_seconds += nap
14+
minutes, seconds = divmod(self.sw_seconds, 60)
15+
self.root.ids.stopwatch.text = (
16+
'%02d:%02d.[size=40]%02d[/size]'%
17+
(int(minutes), int(seconds),
18+
int(seconds* 100 % 100))
19+
)
20+
self.root.ids.time.text = strftime('[b]%H[/b]:%M:%S')
21+
def on_start(self):
22+
Clock.schedule_interval(self.update_time, 0)
23+
def start_stop(self):
24+
self.root.ids.start_stop.text =(
25+
'Start' if self.sw_started else 'Stop'
26+
)
27+
self.sw_started = not self.sw_started
28+
def reset(self):
29+
if self.sw_started:
30+
self.root.ids.start_stop.text = 'Start'
31+
self.sw_started = False
32+
self.sw_seconds = 0
33+
34+
if __name__ == '__main__':
35+
Window.clearcolor = get_color_from_hex('#101216')
36+
LabelBase.register(
37+
name='Roboto',
38+
fn_regular= 'Roboto-Thin.ttf',
39+
fn_bold= 'Roboto-Medium.ttf'
40+
)
41+
clockApp().run()

OTP/OTP.ipynb

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"import os\n",
10+
"import math\n",
11+
"import random\n",
12+
"import smtplib"
13+
]
14+
},
15+
{
16+
"cell_type": "code",
17+
"execution_count": 2,
18+
"metadata": {},
19+
"outputs": [],
20+
"source": [
21+
"digits=\"0123456789\"\n",
22+
"OTP=\"\"\n",
23+
"for i in range(6):\n",
24+
" OTP+=digits[math.floor(random.random()*10)]\n",
25+
"otp = OTP + \" is your OTP\"\n",
26+
"msg= otp"
27+
]
28+
},
29+
{
30+
"cell_type": "code",
31+
"execution_count": null,
32+
"metadata": {},
33+
"outputs": [],
34+
"source": [
35+
"s = smtplib.SMTP('smtp.gmail.com', 587)\n",
36+
"s.starttls()\n",
37+
"s.login(\"[email protected]\", \"pabitra-banerjee.newsgoogle.org\")\n",
38+
"emailid = input(\"Enter your email: \")\n",
39+
"s.sendmail('&&&&&&&&&&&',emailid,msg)\n",
40+
"a = input(\"Enter Your OTP >>: \")\n",
41+
"if a == OTP:\n",
42+
" print(\"Verified\")\n",
43+
"else:\n",
44+
" print(\"Please Check your OTP again\")"
45+
]
46+
}
47+
],
48+
"metadata": {
49+
"kernelspec": {
50+
"display_name": "Python 3",
51+
"language": "python",
52+
"name": "python3"
53+
},
54+
"language_info": {
55+
"codemirror_mode": {
56+
"name": "ipython",
57+
"version": 3
58+
},
59+
"file_extension": ".py",
60+
"mimetype": "text/x-python",
61+
"name": "python",
62+
"nbconvert_exporter": "python",
63+
"pygments_lexer": "ipython3",
64+
"version": "3.11.3"
65+
},
66+
"orig_nbformat": 4
67+
},
68+
"nbformat": 4,
69+
"nbformat_minor": 2
70+
}

Password-Generator-GUI/main.ipynb

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"import tkinter as tk\n",
10+
"import string\n",
11+
"import random"
12+
]
13+
},
14+
{
15+
"cell_type": "code",
16+
"execution_count": 2,
17+
"metadata": {},
18+
"outputs": [],
19+
"source": [
20+
"def generate_password():\n",
21+
" password = []\n",
22+
" for i in range(5):\n",
23+
" alpha = random.choice(string.ascii_letters)\n",
24+
" symbol = random.choice(string.punctuation)\n",
25+
" numbers = random.choice(string.digits)\n",
26+
" password.append(alpha)\n",
27+
" password.append(symbol)\n",
28+
" password.append(numbers)\n",
29+
" passwords = \" \".join(str(x)for x in password)\n",
30+
" label.config(text=passwords)"
31+
]
32+
},
33+
{
34+
"cell_type": "code",
35+
"execution_count": null,
36+
"metadata": {},
37+
"outputs": [],
38+
"source": [
39+
"root = tk.Tk()\n",
40+
"root.geometry(\"400x300\")\n",
41+
"button = tk.Button(root, text=\"Generate Password\", command=generate_password)\n",
42+
"button.grid(row=1, column=1)\n",
43+
"label = tk.Label(root, font=(\"times\", 15, \"bold\"))\n",
44+
"label.grid(row=4, column=2)\n",
45+
"root.mainloop()"
46+
]
47+
}
48+
],
49+
"metadata": {
50+
"kernelspec": {
51+
"display_name": "Python 3",
52+
"language": "python",
53+
"name": "python3"
54+
},
55+
"language_info": {
56+
"codemirror_mode": {
57+
"name": "ipython",
58+
"version": 3
59+
},
60+
"file_extension": ".py",
61+
"mimetype": "text/x-python",
62+
"name": "python",
63+
"nbconvert_exporter": "python",
64+
"pygments_lexer": "ipython3",
65+
"version": "3.11.3"
66+
},
67+
"orig_nbformat": 4
68+
},
69+
"nbformat": 4,
70+
"nbformat_minor": 2
71+
}

0 commit comments

Comments
 (0)