-
Notifications
You must be signed in to change notification settings - Fork 0
/
B_CAT_2.py
56 lines (38 loc) · 1.41 KB
/
B_CAT_2.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
import datetime as dt
import matplotlib.pyplot as plt
import pandas_datareader as pdr
import yfinance as yf
from tkinter import Button, Entry, Tk, mainloop
current_date = str(dt.date.today())
start_date_ode = str(str(current_date[0:-2]) + str(int(current_date[-2::]) - 1))
start_date_fye = str(str(int(current_date[0:4]) - 5) + str(current_date[4::]))
def get_change(current, previous):
if current == previous:
return 0
try:
return (abs(current - previous) / previous) * 100.0
except ZeroDivisionError:
return float('INF')
def get_commands_gui():
command_entered = []
root = Tk()
root.title('SHARES AND PRICE ENTRY')
root.geometry('325x30')
shares_command = Entry(root)
shares_command.grid(row=0, column=1)
price_command = Entry(root)
price_command.grid(row=0, column=2)
def get_command_globals():
command_entered.append(shares_command.get())
command_entered.append(price_command.get())
root.destroy()
button_entry = Button(root, text='SUBMIT', command=get_command_globals)
button_entry.grid(row=0, column=3)
def enter_press(*args, **kwargs):
button_entry.invoke()
shares_command.bind('<Return>', enter_press)
price_command.bind('<Return>', enter_press)
mainloop()
print(command_entered)
# return command_entered
get_commands_gui()