-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuserinput.py
67 lines (49 loc) · 1.53 KB
/
userinput.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
from ppip_function import pip, plants, ppip
from tkinter import Tk, Canvas, Frame, BOTH
vegetables = [
{"carrot": 1},
{"potato": 2},
{"cabbagge":3},
{"rosemary":4}
]
picked=[]
print("what would you like to grow? \n1. Potato \n2. Cabbage \n3. Carrot \n4. Rosemary \nEnter the number of one of them separated by commas")
userinput=input()
x=userinput.split(",")
print(x)
for r in x:
s=int(r)
picked.append(vegetables[s])
print("What are the dimensions of your allotment. Format: x,y")
widthinput=input("width:")
print (widthinput)
width = float(widthinput)
"""if widthinput != type(float) or type(int):
print("error: value must be integer or float")"""
heightinput=input("height:")
height = float(heightinput)
"""if heightinput != type(float) or type(int):
print("error: value must be integer or float")"""
# for key in picked:
# minimum_amount = input("Is there a maximum number of " + key )
ppip(height,width,2.5)
bounds=[0,width,height,0]
class Example(Frame):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.master.title("Colours")
self.pack(fill=BOTH,expand=1)
canvas = Canvas(self)
canvas.create_rectangle(0,5*width,5*height,0,
outline="#fb0", fill="#fb0")
for plant in plants:
canvas.create_bitmap(5*plant["x"],5*plant["y"],bitmap="warning")
canvas.pack(fill=BOTH, expand=1)
def main():
root = Tk()
ex = Example()
root.mainloop()
if __name__ == '__main__':
main()