Jul-27-2020, 04:01 AM
i tried to write a small program using tkinter and other small libraries, but i ran into a problem converting the string into a float in line 13, could anyone help? there might be some other inconsistencies in the program as well (because i didnt really finish it yet), if you can also help me with those, that would be awesome, thank you!
import tkinter as tk
import random
import time
window = tk.Tk()
def startthing():
random_float = random.random() + 1
limit = random.randint(0,10)
x = 0
bet = bettingentry.get()
value = int(rising["text"])
while x!=limit:
betting["text"] = (float(bet) * random_float)
x = x + 1
time.sleep(1)
rising = tk.Label(text = 1)
rising.pack()
betting = tk.Label(text = 0)
betting.pack()
bettingentry = tk.Entry()
bettingentry.pack()
buttonentry = tk.Button(
text = "bet the money /",
command = startthing()
)
buttonentry.pack()
buttonentry.bind("<Button-1>", startthing())
window.geometry('500x500')
window.mainloop()Error:File "/Users/nope/Desktop/testing_app.py", line 13, in startthing
betting["text"] = (float(bet) * random_float)
ValueError: could not convert string to float:
