-
Notifications
You must be signed in to change notification settings - Fork 1
/
investment.py
53 lines (49 loc) · 1.71 KB
/
investment.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
import func
from tkinter import *
import date
def one_hour_invest(a):
global type_of_invest
type_of_invest = 'o'
func.destroy(a)
file_name = func.name+"balance.txt"
fi=open(file_name,"r")
read_bal=fi.readline()
if int(read_bal) > 0:
n=func.name+"date.txt"
func.balance = int(func.read_bal)-50
invest_button=Button(a,text="Invest",command=lambda:func.chekck_for_file(a,type_of_invest))
invest_button.grid(row=1,column=1)
fi.close()
def six_hour_invest(a):
type_of_invest = 's'
func.destroy(a)
file_name = func.name+"balance.txt"
fi=open(file_name,"r")
read_bal=fi.readline()
if int(read_bal) > 0:
func.balance = int(func.read_bal)-150
invest_button=Button(a,text="Invest",command=lambda:date.chekck_for_file(a,type_of_invest))
invest_button.grid(row=1,column=1)
fi.close()
def twelve_hour_invest(a):
type_of_invest = 't'
func.destroy(a)
file_name = func.name+"balance.txt"
fi=open(file_name,"r")
read_bal=fi.readline()
if int(read_bal) > 0:
n=func.name+"date.txt"
func.balance = int(func.read_bal)-300
invest_button=Button(a,text="Invest",command=lambda:date.chekck_for_file(a,n,type_of_invest))
invest_button.grid(row=1,column=1)
fi.close()
def invest(a):
func.destroy(a)
l=Label(a,text="Chose one investment plan")
one=Button(a,text="1 hour",command=lambda:one_hour_invest(a))
two=Button(a,text="6hours",command=lambda:six_hour_invest(a))
three=Button(a,text="One day",command=lambda:twelve_hour_invest(a))
l.grid(row=0,column=0)
one.grid(row=1,column=0)
two.grid(row=1,column=1)
three.grid(row=1,column=2)