-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFgoogle.py
80 lines (40 loc) · 1.56 KB
/
Fgoogle.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import mysql.connector
import easygui
def get_recipie(food_name):
mydb = mysql.connector.connect(
host = 'localhost',
username = 'viraj',
password = 'pumpulili',
database = 'viraj'
)
c = mydb.cursor()
c.execute('select food_ingredients,procedure from food_recipie where food_name="{}"'.format(food_name))
r = c.fetchall()
for records in r:
food_ingredents = records[0]
procedure = records[1]
easygui.msgbox("ingredents\n\n{}\n\n\nprocedure\n\n{}".format(food_ingredents,procedure))
def add_recipie(food_name,ingredients,procedure):
mydb = mysql.connector.connect(
host = 'localhost',
username = 'viraj',
password = 'pumpulili',
database = 'viraj'
)
c = mydb.cursor()
c.execute('INSERT INTO food_recipie(food_name,food_ingredents,procedure) VALUES("{}","{}","{}")'.format(food_name))
mydb.commit()
choices = easygui.enterbox('do you want to add recipie or get recipie? ')
if choices == 'add recipie':
how_much_ingredients = int(easygui.enterbox('how much ingredents you want to add:'))
ingredients = ''
number = 0
for x in range(how_much_ingredients):
number += 1
ingredient = easygui.enterbox('{}.ingredent: '.format(number))
ingredients += '{}.{}\n'.format(number,ingredient)
procedure = easygui.textbox('procedure')
add_recipie(procedure,ingredients)
if choices == 'get recipie':
food_name = easygui.enterbox('Enter food item:')
get_recipie(food_name)