My Program doesnt set the output result from the function.
I have a GUI where they can pick from 3 foods, they then put how much weight they want. they hit Calculate button and it calls a function where is grabs the weight and * by a stored prices.
I get error: TypeError: can't multiply sequence by non-int of type 'list'
Program Code:
from tkinter import *
#libary of feed cost and size
Pellets = ['Pellets', 22.75, 100.00] #name, 10kg cost, 50kg cost
Mash = ['Mash', 20.50, 90.00] #name, 10kg cost, 50kg cost
Enhanced = ['Enhanced', 25.50, 125.50] #name, 10kg cost, 50kg cost
Size = ['10KG', '50KG'] #weight 1, weight 1
def close_window():
window.destroy()
def totalcost1():
weightneeded = [float(weight.get())]
pellets10kg = [float(Pellets[1])]
totalCost = (weightneeded*pellets10kg)
resultTotalCost.set("${0:,.2f}".format(totalCost))
window = Tk()
window.geometry("1000x500")
window.resizable(0, 0)
window.title("Chook Food Calcuator")
lblFoodList = Label(window, text='Please Select a food type:')
lblFoodList.grid(column=1, row=0, padx=12, pady=25)
#Food Selection Dropdown Menu
FoodSelection = StringVar(window)
FoodSelection.set("Pellets") # default value
#list of foods
x = OptionMenu(window, FoodSelection, Pellets[0], Mash[0], Enhanced[0])
x.grid(column=2, row=0, sticky="e")
lblFoodList = Label(window, text='Please Select the total weight of food you wish to buy:')
lblFoodList.grid(column=1, row=1, padx=25, pady=50, sticky='n')
weight = StringVar()
entWeight = Entry(window, width=20, textvariable=weight)
entWeight.grid(column=2, row=1, padx=25, pady=50, sticky='n')
btnCalculate = Button(window, text='Calculate', command=totalcost1)
btnCalculate.grid(column=3, row=1, padx=25, pady=25, sticky='e')
lblTotalCost = Label(window, text='Total Cost:')
lblTotalCost.grid(column=1, row=3, padx=25, pady=25)
resultTotalCost = StringVar()
entTotalCost = Entry(window, width=20, textvariable=resultTotalCost, state="readonly")
entTotalCost.grid(column=2, row=3, padx=25, pady=50, sticky='n')
btnQuit = Button(window, text='Quit', command=close_window)
btnQuit.grid(column=6, row=4, sticky='se')
window.mainloop( )
With the current code I neet the output feild to be (input*storedprice)
the error is here
weightneeded = [float(weight.get())]
pellets10kg = [float(Pellets[1])]
try to print
print(weightneeded)
print(pellets10kg)
it seems that you are trying to multiply two list object, as python say to you...
get error: TypeError: can't multiply sequence by non-int of type 'list'
try so
def totalcost1():
weightneeded = float(weight.get())
pellets10kg = float(Pellets[1])
print(weightneeded)
print(pellets10kg)
totalCost = (weightneeded*pellets10kg)
resultTotalCost.set("${0:,.2f}".format(totalCost))
I didnt make Weight a int. It is know
def totalcost1():
inputwieght = int(weight.get())
totalCost = inputwieght*Pellets[1]
resultTotalCost.set("${0:,.2f}".format(totalCost))
Related
I have tried StringVar, I've tried set().
Note: The program successfully calculates the value and returns the answer in a seperate pop-up, but I would like it to display the answer in the readonly "yards" entry field as well.
import tkinter as tk
import tkinter.ttk as ttk
#Formats all of the visible elements of the tkninter GUI.Connects the buttons to their functions.
class MetersToYardsApp:
def __init__(self, parent):
topLevel = ttk.Frame(parent, padding=10)
topLevel.grid(column=0, row=0)
headerLabel = ttk.Label(topLevel, text="Meters to Yards Calculator", font="{Arial} 16 {bold}")
headerLabel.grid(column=0, row=0, sticky="nsew")
inputFrame = ttk.Frame(topLevel, padding=10)
inputFrame.grid(column=0, row=1, sticky="nsew")
metersLabel = ttk.Label(inputFrame, text="Meters:")
yardsLabel = ttk.Label(inputFrame, text="Yards:")
metersEntry = ttk.Entry(inputFrame)
yardsEntry = ttk.Entry(inputFrame, state="readonly")
metersLabel.grid(column=0, row=0, sticky="e")
yardsLabel.grid(column=0, row=1, sticky="e")
metersEntry.grid(column=1, row=0, pady=3)
yardsEntry.grid(column=1, row=1, pady=3)
buttonFrame = ttk.Frame(topLevel)
buttonFrame.grid(column=0, row=2, sticky='nsew')
clearButton = ttk.Button(buttonFrame, text="Clear", command=self.clear)
okayButton = ttk.Button(buttonFrame, text="Calculate", command=self.calculate)
clearButton.grid(column=0, row=0, padx=3)
okayButton.grid(column=1, row=0)
self.mainWindow = topLevel
self.metersEntry = metersEntry
self.yardsEntry = yardsEntry
#Clear Button
def clear(self):
# print("Clear")
self.metersEntry.delete(0, tk.END)
#Formats the Pop-up that displays the answer
def showAnswer(self, parent, text):
rootFrame = ttk.Frame(parent, padding=10)
rootFrame.grid(column=0, row=0)
headerLabel = ttk.Label(rootFrame, text="The Answer", font="{Arial} 14 {bold}")
headerLabel.grid(column=0, row=0)
answerLabel = ttk.Label(rootFrame, text=text, justify=tk.CENTER)
answerLabel.grid(column=0, row=1)
#Performs Calculations if input is valid.
def calculate(self):
# print("Calculate Meters: ", self.metersEntry.get())
try:
meters = float(self.metersEntry.get())
yards = meters * 1.094
except:
top2 = tk.Toplevel(self.mainWindow)
self.showAnswer(top2, "There was an Error.\n" + "Please Enter a Valid Number for Meters")
# print("Please Enter a Valid Number for Meters.")
return
print(meters, "Meters is ", yards, "Yards. ")
top2 = tk.Toplevel(self.mainWindow)
self.showAnswer(top2, str(meters) + " Meters is equivalent to " + "{:.2f} Yards.".format(yards))
return float(yards)
You do have to use DoubleVar to update the Entry element:
yards_entry_var = tk.DoubleVar(inputFrame, 0)
Then you should place it inside the Entry element 'textvariable':
yardsEntry = ttk.Entry(inputFrame, textvariable=yards_entry_var, state="readonly")
to use it outside the init function:
self.yards_entry_var = yards_entry_var
in the calculate function, after calculating the yards:
self.yards_entry_var.set(yards)
And finally, when you want to clear the value in the clear function:
self.yards_entry_var.set(0)
for one of my first little projects I coded a fitnesscalculator last evening. Which has 3 functionalities at the start: Calculating the 1RM, BMI and FFMI. I'm running into the problem of overlapping labels when I first calculate the 1RM and then the FFMI. I have already googled and looked for similar threads but I couldn't find an answer to my solutions as my Gui is and its functionalities are based around a combobox. Please excuse the rather messy code, but I have already tried several methods to deal with this problem
from tkinter import *
from PIL import Image, ImageTk
from tkinter import ttk
root = Tk()
root.geometry("400x400")
root.title("Fitness Calculator")
#dropdown
Options = ["1RM Calculator", "BMI Calculator", "FFMI Calculator"]
#functions
def picker(input):
global calculate_button
global bf_box
global bf_label
global result_label
global result2_label
global result3_label
calculate_button.destroy()
result_label.pack_forget()
result2_label.destroy()
result3_label.destroy()
bf_label.destroy()
bf_box.destroy()
selected = drop.get() #holt sich wert vom dropdown
####################RM CALCULATOR####################
if selected == Options[0]:
#labels
weight_label = Label(root,text="Enter your training weight here: ", padx=10, pady=10)
weight_label.grid(row=2, column=0, sticky=W)
reps_label = Label(root,text="Enter your repetitions here: ", padx=10)
reps_label.grid(row=3, column=0, sticky=W)
def calculate():
weight = int(weight_box.get())
reps = int(reps_box.get())
one_rm = round(weight*(36/(37-reps)), 2)
#Result
result_label = Label(root, text="Your 1RM is: " + str(one_rm) + " kg")
result_label.grid(row=4)
weight_box.delete(0,END)
reps_box.delete(0,END)
#Entryfields
weight_box = Entry(root)
weight_box.grid(row=2, column=1)
reps_box = Entry(root)
reps_box.grid(row=3, column=1)
#Calculate button
calculate_button = Button(root,text="Calculate",command=calculate, width=16 )
calculate_button.grid(row=4,column=1,pady=10)
####################BMI CALC####################
if selected == Options[1]:
#LABELS
weight_label = Label(root,text="Enter your weight in kg here: ", padx=10, pady=10)
weight_label.grid(row=2, column=0, sticky=W)
height_label = Label(root,text="Enter your height in cm here: ", padx=10)
height_label.grid(row=3, column=0, sticky=W)
#ENTRY BOXES
weight_box = Entry(root)
weight_box.grid(row=2, column=1)
height_box = Entry(root)
height_box.grid(row=3, column=1)
def calculate():
weight = float(weight_box.get())
height = float(height_box.get())/100
bmi = round(weight/(height**2),0)
#Result
result_label = Label(root, text="Your BMI is: " + str(bmi))
result_label.grid(row=4)
weight_box.delete(0,END)
height_box.delete(0,END)
#Calculate button
calculate_button = Button(root,text="Calculate",command=calculate, width=16 )
calculate_button.grid(row=4,column=1,pady=10)
####################FFMI####################
if selected == Options[2]:
calculate_button.destroy()
#LABELS
weight_label = Label(root,text="Enter your weight in kg here: ", padx=10,pady=5)
weight_label.grid(row=2, column=0, sticky=W)
height_label = Label(root,text="Enter your height in cm here: ", padx=10,pady=5)
height_label.grid(row=3, column=0, sticky=W)
bf_label = Label(root,text="Enter your estimated bodyfat % here: ", padx=10,pady=5)
bf_label.grid(row=4, column=0, sticky=W)
#ENTRY BOXES
weight_box = Entry(root)
weight_box.grid(row=2, column=1)
height_box = Entry(root)
height_box.grid(row=3, column=1)
bf_box = Entry(root)
bf_box.grid(row=4, column=1)
def calculate():
weight = float(weight_box.get())
height = float(height_box.get())/100
bf = float(bf_box.get())
total_bf = weight*(bf)
lean_weight = weight*(1-(bf/100))
ffmi = round((lean_weight/height**2),2)
adjusted_ffmi = ffmi + 6.1 * (1.8 - height)
#Result
result_label = Label(root, text="Lean Mass: " + str(lean_weight) + " kg")
result_label.grid(row=6, sticky=W, padx=5)
result_label2 = Label(root, text="FFMI: " + str(ffmi))
result_label2.grid(row=7, sticky=W, padx=5)
result_label3 = Label(root, text="adjusted-FFMI: " + str(adjusted_ffmi))
result_label3.grid(row=8,sticky=W, padx=5)
weight_box.delete(0,END)
height_box.delete(0,END)
bf_box.delete(0,END)
#Calculate button
calculate_button = Button(root,text="Calculate",command=calculate, width=16 )
calculate_button.grid(row=5,column=1,pady=10)
calculate_button = Button(root,text="Calculate", width=16 )
calculate_button.grid(row=4,column=1,pady=10)
calculate_button.destroy()
#Dropdownbox
drop = ttk.Combobox(root, value=Options, state="readonly")
drop.current(0)
drop.grid(row=0)
drop.bind("<<ComboboxSelected>>", picker)
result_label = Label(root,text="test")
result_label.grid(row=4)
result2_label = Label(root,text="")
result2_label.grid(row=4)
result3_label = Label(root,text="")
result3_label.grid(row=4)
bf_label = Label(root)
bf_box = Entry(root)
picker(drop.current(0))
root.mainloop()
Here a Screenshot of the problem I'm referencing to:
You keep creating a new Label with name result_label in your calculate methods.
This piles the labels on top of each other, since the result_label.destroy() does not remove them from the grid.
Instead of destroying them, keep just one instance (which you already defined global) and then configure them with the new text:
result_label.config(text="Your BMI is: " + str(bmi))
I am making a program that searches a list of stock numbers(the first 8 digit int in the list) and then returns the rest of the values in the list inside the entry boxes but when I click the search button, it does not perform its function. Any advice? (I'm also new to coding, is there any place where I could've shortened my code anywhere to make it more efficient?)
root = Tk()
#lists
car = [19225735, '611926', '2018', 'Hyundai', 'Sonata', 'White', 'Recon', '$25,000',
'Sedan',32,123]
#funtion
def search():
x = stockNumber.get()
if (x == car[0]):
vinNumber.insert(car[1])
make.insert(car[3])
model.insert(car[4])
color.insert(car[5])
status.inset(car[6])
price.insert(car[7])
size.insert(car[8])
mileage.insert(car[9])
#text boxes --------------------------------------------
stockNumber = Entry(root, width=30)
stockNumber.grid(row=0, column=1, padx=20)
vinNumber = Entry(root, width=30)
vinNumber.grid(row=1, column=1, padx=20
year = Entry(root, width=30)
year.grid(row=2, column=1, padx=20)
make = Entry(root, width=30)
make.grid(row=3, column=1, padx=20)
model = Entry(root, width=30)
model.grid(row=4, column=1, padx=20)
color = Entry(root, width=30)
color.grid(row=5, column=1, padx=20)
status = Entry(root, width=30)
status.grid(row=6, column=1, padx=20)
price = Entry(root, width=30)
price.grid(row=7, column=1, padx=20)
size = Entry(root, width=30)
size.grid(row=8, column=1, padx=20)
mileage = Entry(root, width=30)
mileage.grid(row=8, column=1, padx=20)
#button command-------------------------------
enter = Button(root, text = "Search", padx=40, pady=20, command=search)
enter.grid(row=9, column=0)
#labels ------------------------------------------------
snLabel = Label(root, text="Stock Number")
snLabel.grid(row=0, column=0)
vnLabel = Label(root, text="Vin Number")
vnLabel.grid(row=1, column=0)
yearLabel = Label(root, text="Year")
yearLabel.grid(row=2, column=0)
makeLabel = Label(root, text="Make")
makeLabel.grid(row=3, column=0)
modelLabel = Label(root, text="Model")
modelLabel.grid(row=4, column=0)
colorLabel = Label(root, text="Color")
colorLabel.grid(row=5, column=0)
statusLabel = Label(root, text="Status")
statusLabel.grid(row=6, column=0)
sizeLabel = Label(root, text="Size")
sizeLabel.grid(row=7, column=0)
mileLabel = Label(root, text="Mileage")
mileLabel.grid(row=8, column=0)
The Button was working fine, your function was the problem:
def search():
x = int(stockNumber.get())
if (x == car[0]):
vinNumber.insert(0,str(car[1]))
make.insert(0,str(car[3]))
model.insert(0,str(car[4]))
color.insert(0,str(car[5]))
status.insert(0,str(car[6]))
price.insert(0,str(car[7]))
size.insert(0,str(car[8]))
mileage.insert(0,str(car[9]))
This is what i fixed:
stockNumber.get() returns a string, you compare it with an integer, if you do that, it will always be false -> convert it to int with int()
.insert needs an index aswell, not just insert(data) but insert(index, data)
Here is a hint!!!
You need to take a look at each point of data and understand the kind of data you are wanting your function to pull. Yes, you want a number! But is it an "int", a float, what is it???
Take a look at your function for search(). The only reason why it is not grabbing the data is that you need to make sure the function is looking for the right kind of data. Since "stock number" is probably an integer, you would need to specify that in your function.
Get a basic understanding of Python data types:
int
float
string
I have 3 labels and entry boxes, one is Sandwich, the other is drinks and the third one for showing their calculated costs.
There, I expect the user to enter the number of sandwiches and drinks they've had and calculate their price and show it in the third box by using this formula:
totalCost = (cod*30)+(cos*100)
costtotal.set(totalCost)
And it does so perfectly.
However, the problem is, that for example a user doesn't enter anything in the drinks field, I want the interpreter to interpret that empty field as 0 and calculate the sum. But, my program doesn't calculate it if any of the two fields (Drinks and Sandwiches) are empty. So, to counter this I tried:
if not drinks.get():
yourVar = "0"
cod=float(yourVar)
This is the error message I get:
File "C:/Users/Dell E6430/Desktop/trying.py", line 18, in Ref
cod=float(drinks.get())
ValueError: could not convert string to float:
I don't get this error message when I input both fields.
However, it isn't working and the result is same. So, how do I solve that? Thanks.
Here's the full code:
from tkinter import*
root=Tk()
root.geometry("1600x800+0+0")
#------- convert to string
drinks=StringVar()
costtotal=StringVar()
sandwich=StringVar()
#----Frame
f1=Frame(root,width=800, height=700,relief=SUNKEN)
f1.pack(side=LEFT)
def Ref():
cos=float(sandwich.get())
cod=float(drinks.get())
if not drinks.get():
yourVar = "0"
cod=float(yourVar)
totalCost = (cod*30)+(cos*100)
costtotal.set(totalCost)
lblSandwich=Label(f1,font=('arial',16,'bold'),text="Sandwich" , bd=16, anchor='w')
lblSandwich.grid(row=0,column=0)
txtSandwich=Entry(f1,font=('arial',16,'bold'),textvariable=sandwich,bd=10,insertwidth=4,bg="powder blue",justify='right')
txtSandwich.grid(row=0,column=1)
lblDrinks=Label(f1,font=('arial',16,'bold'),text="Drinks" , bd=16, anchor='w')
lblDrinks.grid(row=1,column=0)
txtDrinks=Entry(f1,font=('arial',16,'bold'),textvariable=drinks,bd=10,insertwidth=4,bg="powder blue",justify='right')
txtDrinks.grid(row=1,column=1)
lblcostTotal=Label(f1,font=('arial',16,'bold'),text="Cost of Drinks" , bd=16, anchor='w')
lblcostTotal.grid(row=2,column=0)
txtcostTotal=Entry(f1,font=('arial',16,'bold'),textvariable=costtotal,bd=10,insertwidth=4,bg="powder blue",justify='right')
txtcostTotal.grid(row=2,column=1)
btnTotal=Button(f1,padx=16,pady=8,bd=16,fg="black",font=('arial',16,'bold'),width=10,text="Total", bg="Powder Blue"\
,command=Ref).grid(row=7,column=1)
root.mainloop()
EDIT: By doing
cod=drinks.get()
if not drinks.get():
yourVar = "0"
cod=float(yourVar)
else:
cod=float(drinks.get())
the program runs fine now.
You cannot run float() over anything that is not a valid number. You should probably first check if your get() is returning a number with isnumeric() then if true run float if not set value to zero. That will handle anything not a number and even if it is a letter.
Note I have cleaned up your code a bit to more closely follow PEP8 standards as well as updated your import to help prevent overwriting. import tkinter as tk is always preferred over *.
Try this:
import tkinter as tk
root = tk.Tk()
root.geometry("1600x800+0+0")
cost_total = tk.StringVar()
sandwich = tk.StringVar()
drinks = tk.StringVar()
f1 = tk.Frame(root, width=800, height=700, relief='sunken')
f1.pack(side='left')
def ref():
d = drinks.get()
s = sandwich.get()
if d.isnumeric():
cod = float(d)
else:
cod = 0
if s.isnumeric():
cos = float(s)
else:
cos = 0
total_cost = (cod * 30) + (cos * 100)
cost_total.set(total_cost)
tk.Label(f1, font=('arial', 16, 'bold'), text="Sandwich", bd=16, anchor='w').grid(row=0, column=0)
tk.Entry(f1, font=('arial', 16, 'bold'), textvariable=sandwich, bd=10, insertwidth=4,
bg="powder blue", justify='right').grid(row=0, column=1)
tk.Label(f1, font=('arial', 16, 'bold'), text="Drinks", bd=16, anchor='w').grid(row=1, column=0)
tk.Entry(f1, font=('arial', 16, 'bold'), textvariable=drinks, bd=10, insertwidth=4,
bg="powder blue", justify='right').grid(row=1, column=1)
tk.Label(f1, font=('arial', 16, 'bold'), text="Cost of Drinks", bd=16, anchor='w').grid(row=2, column=0)
tk.Entry(f1, font=('arial', 16, 'bold'), textvariable=cost_total, bd=10, insertwidth=4,
bg="powder blue", justify='right').grid(row=2, column=1)
tk.Button(f1, padx=16, pady=8, bd=16, fg="black", font=('arial', 16, 'bold'), width=10,
text="Total", bg="Powder Blue", command=ref).grid(row=7, column=1)
root.mainloop()
Results:
To answer you question in the comments you can use a list or a couple list to manage large amounts of fields. Consider the below and let me know if you have any questions.
Code:
import tkinter as tk
list_of_foods = [['Coffie', 30], ['Tea', 20], ['Sandwich', 100], ['Apple', 50]]
def ref():
total = 0
for ndex, entry in enumerate(entry_list):
value = entry.get()
if value.isnumeric():
total += float(value) * list_of_foods[ndex][1]
print(total)
else:
total += 0
double_var.set(total)
root = tk.Tk()
double_var = tk.DoubleVar(root, value=0)
entry_list = []
for ndex, sub_list in enumerate(list_of_foods):
tk.Label(root, text=sub_list[0]).grid(row=ndex, column=0)
entry_list.append(tk.Entry(root))
entry_list[-1].grid(row=ndex, column=1)
tk.Entry(root, textvariable=double_var).grid(row=len(entry_list)+2, column=0, columnspan=2)
tk.Button(root, text='Total', command=ref).grid(row=len(entry_list)+3, column=0, columnspan=2)
root.mainloop()
Results:
I am trying to create an example program for my high school class. The idea of the program is you can select a game (a basic version of Steam) from a selection of radiobuttons. The radiobuttons are linked to a IntVar stored in self.library_game. When you select a radiobutton I want to use the value that the radiobutton assigns the Intvar to take a name out of a list and display the name of the game in a label. I want to do this so I can use the IntVar to access other lists. The other lists will show things like the games installed status. if the game is not currently "installed" you will be able to click on a button to update the status to "install" the game so it can be "launched".
The problem i am encountering is: When I try and use the IntVar to access the libraryGames list I get the following error:"list indices must be integers or slices, not method". I have tried to store the value from the IntVar as a regular integer with "test=self.library_game.get" and used "test" to access the list, self.game_selection_label.configure(text = "You have chosen: " + str(libraryGames[test]),fg="#01fc07"), but it doesn't work.
I am not the strongest programmer and am really pushing my ceiling with this stuff, so any help would be amazing.
from tkinter import*
# Variables and Lists
#Classes
libraryGames=["The Witcher 3: Wild Hunt GOTE", "Jurassic World: Evolution", "Red Dead Redemption 2","Mass Effect Trilogy","Subnautica"]
libraryGamesInstall=[True,False, False, False, False]
class SteamGUI:
def __init__(self, parent):
#variables
global libraryGames
global libraryGamesInstall
WD=800
self.header =PhotoImage(file = "header.gif")
self.library_game = IntVar()
self.library_game.set = ()
Title=Label(parent, image = self.header, width=WD, anchor=N)
Title.grid(row=0, column=0,columnspan=2, sticky=N,padx=2, pady=2)
#User Library Menu
frame1=Frame(bg="#000000",)
frame1.grid(row=1, column=0, sticky = 'w')
library_label=Label(frame1, text="User Library",bg="#000000",fg="#01fc07",font=("Eras Demi ITC","40"), anchor=N)
library_label.grid(row=0, column=0,columnspan=2, sticky=N,padx=2, pady=2)
radio1 = Radiobutton(frame1, variable = self.library_game, value = 0,text =libraryGames[0],
bg="#000000",fg="#ffffff",font=("Calibri","20"), command = self.library_choice)
radio1.grid(row=1, column=0, columnspan=2, sticky = 'w')
radio2 = Radiobutton(frame1, variable = self.library_game, value =1,text =libraryGames[1],
bg="#000000",fg="#ffffff",font=("Calibri","20"), command = self.library_choice)
radio2.grid(row=2, column=0, columnspan=2, sticky = 'w')
radio3 = Radiobutton(frame1, variable = self.library_game, value =2,text =libraryGames[2],
bg="#000000",fg="#ffffff",font=("Calibri","20"),command = self.library_choice)
radio3.grid(row=3, column=0, columnspan=2, sticky = 'w')
radio4 = Radiobutton(frame1, variable = self.library_game, value =3,text =libraryGames[3],
bg="#000000",fg="#ffffff",font=("Calibri","20"),command = self.library_choice)
radio4.grid(row=4, column=0, columnspan=2, sticky = 'w')
radio5 = Radiobutton(frame1, variable = self.library_game, value =4,text =libraryGames[4],
bg="#000000",fg="#ffffff",font=("Calibri","20"),command = self.library_choice)
radio5.grid(row=5, column=0, columnspan=2, sticky = 'w')
self.game_selection_label=Label(frame1, text="No game selected", bg="#000000", fg="#ffffff", width="50",)
self.game_selection_label.grid(row=6, column=0, columnspan=2, sticky='w')
self.game_install_status_label=Label(frame1, text="Install Status", bg="#000000", fg="#ffffff", width="50",)
self.game_install_status_label.grid(row=7, column=0, sticky='w', pady=10)
self.playLabel =Label(frame1,text="Game Status", bg="#000000", fg="#ffffff", width="50", pady=10)
self.playLabel.grid(row=9, column=0, sticky='w')
installButton=Button(frame1, text="Install", width = 20, font=("Eras Demi ITC","10"), pady=10)
installButton.grid(row=8, column=0, sticky = 'sw',)
playButton=Button(frame1, text="Play", width = 20,font=("Eras Demi ITC","10"), pady=10)
playButton.grid(row=8, column=0, sticky = 'se',)
frame2=Frame(bg="#ffffff",)
frame2.grid(row=1, column=1)
def library_choice(self):
test=0
test=self.library_game.get
print("hi", self.library_game.get)
self.game_selection_label.configure(text = "You have chosen: " + str(libraryGames[test]),fg="#01fc07")
#self.game_selection_label.configure(text = "You have chosen: The witcher 3!!!!!",fg="#01fc07")
#Main Routine
root=Tk()
window = SteamGUI(root)
root.geometry("800x700+0+0")
root.title("Steam Basic")
root.mainloop()