Error: Attempt to index global 'fifteenButton' (a nil value) - button

Error Line: 92
Attempt to index global 'fifteenButton' (a nil value)
stack traceback:
[C]: ?
/Users/ejaytumacder/dev/HappyShaker/time_select.lua:92: in function </Users/ejaytumacder/dev/HappyShaker/time_select.lua:90>
?: in function 'dispatchEvent'
?: in function '?'
?: in function 'gotoScene'
/Users/ejaytumacder/dev/HappyShaker/time_select.lua:12: in function '_onRelease'
?: in function '?'
?: in function <?:406>
?: in function <?:218>
This is the error I get above, and below is the code that it originates from.
local storyboard = require("storyboard")
local widget = require("widget")
local scene = storyboard.newScene()
local mydata = require("mydata")
local function fifteenSecondButtonEvent( event )
local phase = event.phase
if "ended" == phase then
mydata.time = 15
storyboard.gotoScene("play")
end
end
local function thirtySecondButtonEvent( event )
local phase = event.phase
if "ended" == phase then
mydata.time = 30
storyboard.gotoScene("play")
end
end
local function sixtySecondButtonEvent( event )
local phase = event.phase
if "ended" == phase then
mydata.time = 60
storyboard.gotoScene("play")
end
end
function scene:createScene( event )
local group = self.view
local timeText = display.newText("TIME", 160, 70, "Helvetica", 30)
group:insert( timeText )
local fifteenButton = widget.newButton {
time = 15,
left = 75,
top = 150,
width = 164,
height = 42,
defaultFile = "fifteen_button.png",
overFile = "fifteen_button_pressed.png",
label = "",
onRelease = fifteenSecondButtonEvent
}
--group:insert(fifteenButton)
local thirtyButton = widget.newButton {
time = 30,
left = 75,
top = 250,
width = 164,
height = 42,
defaultFile = "thirty_button.png",
overFile = "thirty_button_pressed.png",
label = "",
onRelease = thirtySecondButtonEvent
}
--group:insert(thirtyButton)
local sixtyButton = widget.newButton {
time = 60,
left = 75,
top = 350,
width = 164,
height = 42,
defaultFile = "sixty_button.png",
overFile = "sixty_button_pressed.png",
label = "",
onRelease = sixtySecondButtonEvent
}
group:insert(fifteenButton)
group:insert(thirtyButton)
group:insert(sixtyButton)
print( "Number of children in Display Group: " .. group.numChildren )
end
function scene:willEnterScene( event )
local group = self.view
end
function scene:enterScene( event )
local group = self.view
end
function scene:exitScene( event )
local group = self.view
fifteenButton:removeEventListener( 'onRelease', fifteenSecondButtonEvent ) -- line 92
thirtyButton:removeEventListener( 'onRelease', thirtySecondButtonEvent )
sixtyButton:removeEventListener( 'onRelease', sixtySecondButtonEvent )
timeText:removeSelf()
timeText = nil
if fifteenButton then
fifteenButton:removeSelf()
fifteenButton = nil
end
if thirtyButton then
thirtyButton:removeSelf()
thirtyButton = nil
end
if sixtyButton then
sixtyButton:removeSelf()
sixtyButton = nil
end
display.remove(group)
storyboard.removeScene( "time_select" )
end
function scene:destroyScene( event )
local group = self.view
end
scene:addEventListener("createScene", scene)
scene:addEventListener("willEnterScene", scene)
scene:addEventListener("enterScene", scene)
scene:addEventListener("exitScene", scene)
scene:addEventListener("destroyScene", scene)
return scene

So your question has two problems going on. I'm going to address why you're getting that error.
You are getting that error on line 92 because you are defining fifteenButton in the createScene function. as a local object. So it can't be referenced outside the createScene function. To fix that issue you should add local fifteenButton, thirtyButton, sixtyButton to the top of the file. Then remove the local from before the same named variables in the createScene. This will fix your error.

Related

Why do I get error "missing 1 required positional argument"?

Why I continue getting the error :
missing 1 required positional argument: 'category_id'
when the argument is already passed within query function in Backend class? I also don't understand the error of unfilled self or missing positional argument self:
missing 1 required positional argument: 'self'
I tried passing self to display_account_types() in Frontend class but it doesn't reflect. Do I need to pass self within the inner nested functions within a class?
import tkinter
from tkinter import *
from tkinter import ttk
import tkinter.messagebox
import sqlite3
root =Tk()
root.title('Simple Application')
root.config(bg='SlateGrey')
root.geometry("")
# BackEnd
class Backend():
def __init__(self):
self.conn = sqlite3.connect('accounting.db')
self.cur = self.conn.cursor()
self.conn.execute("""CREATE TABLE IF NOT EXISTS account_type(
id INTEGER PRIMARY KEY,
category_type INTEGER NOT NULL,
category_id TEXT NOT NULL
)"""),
self.conn.commit()
self.conn.close()
def insert_account_type(self, category_type, category_id):
self.conn = sqlite3.connect('accounting.db')
self.cur = self.conn.cursor()
self.cur.execute("""INSERT INTO account_type(category_id, category_type) VALUES(?,?);""",
(self,category_type, category_id,))
self.conn.commit()
self.conn.close()
def view_account_type(self):
self.conn = sqlite3.connect('accounting.db')
self.cur = self.conn.cursor()
self.cur.execute("SELECT * FROM account_type")
self.rows = self.cur.fetchall()
self.conn.close()
return self.rows
# calling the class
tb = Backend()
# Front End
class Frontend():
def __init__(self, master):
# Frames
self.top_frame = LabelFrame(master,bg ='SlateGrey', relief=SUNKEN)
self.top_frame.pack()
self.bottom_frame = LabelFrame(master, bg = 'SlateGrey', relief=SUNKEN)
self.bottom_frame.pack()
self.right_frame = LabelFrame(self.top_frame, bg = 'SlateGrey', relief = FLAT,
text = 'Details Entry',fg = 'maroon')
self.right_frame.pack(side = RIGHT, anchor = NE)
self.side_frame = LabelFrame(self.top_frame,bg ='SlateGrey',relief=SUNKEN,text = 'Menu Buttons',fg = 'maroon')
self.side_frame.pack(side = LEFT,anchor = NW)
self.bot_frame = LabelFrame(self.bottom_frame, bg='Grey',relief = SUNKEN,text = 'Field View',fg = 'maroon')
self.bot_frame.pack(side = BOTTOM,anchor = SW)
# Side Buttons
self.btn1 = Button(self.side_frame,
text='Main Account Types',
bg='SteelBlue4',
font=('cambria', 11),
anchor=W,
fg='white',
width=18,height=2,
command=lambda :[self.main_account()])
self.btn1.grid(row=0, column=0, pady=0, sticky=W)
def main_account(self):
# variables
self.category_type = StringVar()
self.category_id = StringVar()
# functions
def add_main_accounts():
if self.category_type.get() == "" or self.category_id.get() == "":
tkinter.messagebox.showinfo('All fields are required')
else:
Backend.insert_account_type(
self.category_type.get(),
self.category_id.get(),) # category type unfilled
tkinter.messagebox.showinfo('Entry successful')
def display_account_types(self):
self.trv.delete(*self.trv.get_children())
for self.rows in Backend.view_account_type(self):
self.trv.insert("", END, values=self.rows)
def get_account_type(e):
self.selected_row = self.trv.focus()
self.data = self.trv.item(self.selected_row)
global row
row = self.data["values"]
"""Grab items and send them to entry fields"""
self.category_id.set(row[1])
self.category_type.set(row[2])
"""=================TreeView==============="""
# Scrollbars
ttk.Style().configure("Treeview", background = "SlateGrey", foreground = "white", fieldbackground = "grey")
scroll_x = Scrollbar(self.bot_frame, orient = HORIZONTAL)
scroll_x.pack(side = BOTTOM, fill = X)
scroll_y = Scrollbar(self.bot_frame, orient = VERTICAL)
scroll_y.pack(side = RIGHT, fill = Y)
# Treeview columns & setting scrollbars
self.trv = ttk.Treeview(self.bot_frame, height=3, columns=
('id', 'category_id', 'category_type'), xscrollcommand = scroll_x.set, yscrollcommand = scroll_y.set)
# Treeview style configuration
ttk.Style().configure("Treeview", background = "SlateGrey", foreground = "white", fieldbackground = "grey")
# Configure vertical and Horizontal scroll
scroll_x.config(command = self.trv.xview)
scroll_y.config(command = self.trv.yview)
# Treeview Headings/columns
self.trv.heading('id', text = "No.")
self.trv.heading('category_id', text = 'Category ID')
self.trv.heading('category_type', text = 'Category Type')
self.trv['show'] = 'headings'
# Treeview columns width
self.trv.column('id', width = 23)
self.trv.column('category_id', width = 70)
self.trv.column('category_type', width = 100)
self.trv.pack(fill = BOTH, expand = YES)
# Binding Treeview with data
self.trv.bind('<ButtonRelease-1>',get_account_type)
# Account Types Labels
self.lbl1 = Label(self.right_frame,text = 'Category ID',anchor = W,
width=10,font = ('cambria',11,),bg = 'SlateGrey')
self.lbl1.grid(row = 0,column = 0,pady = 5)
self.lbl2 = Label(self.right_frame, text = 'Category Type', anchor = W,
width = 10,font = ('cambria',11,),bg = 'SlateGrey')
self.lbl2.grid(row = 1, column = 0,pady = 5,padx=5)
self.blank_label = Label(self.right_frame, bg='SlateGrey')
self.blank_label.grid(row=2, columnspan=2, pady=10)
# Account Type Entries
self.entry1 = Entry(self.right_frame,textvariable = self.category_id,
font = ('cambria',11,),bg = 'Grey',width=14)
self.entry1.grid(row = 0,column=1,sticky = W,padx = 5)
self.entry2 = Entry(self.right_frame, textvariable = self.category_type,
font = ('cambria', 11,), bg = 'Grey',width = 14)
self.entry2.grid(row = 1, column = 1, sticky = W,pady = 5,padx = 5)
# Buttons
self.btn_1 = Button(self.right_frame,text = 'Add',font = ('cambria',12,'bold'),bg = 'SlateGrey',
activebackground='green', fg = 'white',width=12,height = 2,relief=RIDGE,
command = lambda :[add_main_accounts()])
self.btn_1.grid(row = 3,column = 0,pady = 15)
self.btn_2 = Button(self.right_frame, text = 'View', font = ('cambria', 12, 'bold'),
bg = 'SlateGrey',command=lambda :[display_account_types()],
activebackground='green', fg ='white', width=12, height = 2, relief = RIDGE)
self.btn_2.grid(row = 3, column = 1)
# calling the class
app = Frontend(root)
root.mainloop()
I got and answer to this question,
I just passed in the 'self' argument to the inner nested functions of the class as below and it worked.
# functions
def add_main_accounts(self):
if self.category_id.get() == "" or self.category_type.get() == "":
tkinter.messagebox.showinfo('All fields are required')
else:
Backend.insert_account_type(self,
self.category_id.get(),
self.category_type.get()) # category type unfilled
tkinter.messagebox.showinfo('Entry successful')
def display_account_types(self):
self.trv.delete(*self.trv.get_children())
for rows in Backend.view_account_type(self):
self.trv.insert("", END, values = rows)
return
def get_account_type(e):
self.selected_row = self.trv.focus()
self.data = self.trv.item(self.selected_row)
global row
self.row = self.data["values"]
"""Grab items and send them to entry fields"""
self.category_id.set(row[1])
self.category_type.set(row[2])
I think you should remove the self in display_account_types function like you did to the previous one.

Is there a way to make Force Network D3 labels remain permanently, rather than hover over?

Here is my program:
networkD3::forceNetwork(Links = links.d3, Nodes = nodes.d3,
Source = "from", Target = "to",
NodeID = "node_id", Group = "group_id",
zoom = TRUE, opacity = 1.0, legend = TRUE,
fontSize = 12)
Then I tried:
onRender(network, "function(el,x) { d3.selectAll('.node').on('mouseover', null); }")
This just removes the labels all together. Ideally, I want to be able to click a node, and then have a node's label remain, after I hover away from it.
Thanks!!
Use opacityNoHover = 1 as a parameter to the forceNetwork() function. This and all other options are in the help file (type ?networkD3::forceNetwork in the console). That will make all the labels visible all the time.
If you want to prevent the labels from disappearing when you move the mouse away from the node, just modify your code to null the mouseout event instead of the mouseover event...
onRender(network, "function(el,x) { d3.selectAll('.node').on('mouseout', null); }")
UPDATE 2020.04.09
Here's a solution for making a click turn on or off the label for that node...
library(networkD3)
library(htmlwidgets)
network <-
forceNetwork(Links = MisLinks, Nodes = MisNodes, Source = "source",
Target = "target", Value = "value", NodeID = "name",
Group = "group", opacity = 1)
clickjs <-
"function(el, x) {
var options = x.options;
var svg = d3.select(el).select('svg');
var node = svg.selectAll('.node');
var link = svg.selectAll('link');
var mouseout = d3.selectAll('.node').on('mouseout');
function nodeSize(d) {
if (options.nodesize) {
return eval(options.radiusCalculation);
} else {
return 6;
}
}
d3.selectAll('.node').on('click', onclick);
function onclick(d) {
if (d3.select(this).on('mouseout') == mouseout) {
d3.select(this).on('mouseout', mouseout_clicked);
} else {
d3.select(this).on('mouseout', mouseout);
}
}
function mouseout_clicked(d) {
node.style('opacity', +options.opacity);
link.style('opacity', +options.opacity);
d3.select(this).select('circle').transition()
.duration(750)
.attr('r', function(d){return nodeSize(d);});
d3.select(this).select('text').transition()
.duration(1250)
.attr('x', 0)
.style('font', options.fontSize + 'px ');
}
}
"
onRender(network, clickjs)

Runtime error with corona app

I made a very simple app with a some simple functions and it is working very well on the corona simulator as in the Screen shot but when i built an APK file i got the following error when i opened the app on my phone "c:\Users\Moamen\Documents\Corona projects\Learning\main.lua:36:attempt to index global 'an'(a nil value) "
This is the app error:
Photo for the app on corona simulator:
and this is the Working folder
code:
-----------------------------------------------------------------------------------------
--
-- main.lua
--
-----------------------------------------------------------------------------------------
-- Your code here
sound = audio.loadStream( "test2.mp3" )
ssound = audio.loadSound( "test.wav")
function com( )
audio.play( ssound )
audio.setVolume( .5)
--body
end
local options={duration = 10000 , onComplete = com }
audio.play( sound )
audio.setVolume( .25 )
group = display.newGroup()
function Puse( event)
if ("began" == event.phase) then
audio.pause()
end
-- body
end
function Resume( event)
if ("began" == event.phase) then
audio.resume( )
end
--body
end
--local widget = require("widget")
--widget.setTheme( "widget_theme_ios" )
an = display.newImage( "bg.JPG" ,150,250 )
an.xScale = .3
an.yScale = .7
--aa = display.newImageRect("bg2.JPG",100,100)
--aa.x=160
--aa.y=230
text1 =display.newText({text= "TechForm" , x=455 , y= 1 , fontSize=("60")})
transition.to( text1, {x=150,y=1,time =2000} )
text2=display.newText({text= "The android app that made by " , x=455 , y= 70 , fontSize=("20")})
transition.to( text2, {x=160,y=70,time =4000} )
text3=display.newText({text= "Moamen Hassaballah " , x=460 , y= 120 , fontSize=("30")})
transition.to( text3, {x=160,y=120,time =5000} )
--display.newImage("ando.png",160 ,350)
--display.newCircle( 300, 300, 10 )
rect = display.newRect( 170, 475, 400, 100 )
rect:setFillColor(.117,.244,.244)
ttext=display.newText({text="Thanks for using our app", x=150, y=470 ,fontSize=25} )
--rect:removeSelf( )
function Touching( event)
if ("began" == event.phase) then
x=math.random( .1,.9 )
y=math.random( .1,.9 )
z=math.random( .1,.9 )
rect:setFillColor( x,y,z )
end
end
rect2=display.newRect( 70, 387, 125, 23 )
rect:addEventListener( "touch", Touching )
button = display.newImage("button.png",60,334)
button.xScale=.4
button.yScale=.4
function ch_color( event)
if ("began" == event.phase) then
x=math.random( .1,.9 )
y=math.random( .1,.9 )
z=math.random( .1,.9 )
text3:setFillColor( x,y,z )
end
end
rect2:addEventListener( "touch", ch_color )
local widget = require("widget")
widget.setTheme( "widget_theme_ios" )
function login(event)
if ("began" == event.phase) then
rect:removeSelf( )
function login2( event)
if ("began" == event.phase) then
rect = display.newRect( 170, 475, 400, 100 )
rect:setFillColor(.117,.244,.244)
rect:addEventListener( "touch", Touching )
ttext:toFront( )
btn = widget.newButton{top=365,left=150 , label="Login" , onEvent=login}
btn.xScale=.8
btn.yScale=.7
end
-- body
end
btn = widget.newButton{top=365,left=150 , label="Login" , onEvent=login2}
btn.xScale=.8
btn.yScale=.7
end
-- body
end
local btn = widget.newButton{top=365,left=150 , label="Login" , onEvent=login}
btn.xScale=.8
btn.yScale=.7
local bb = widget.newButton{ label = "Puse" , top = 250 , left = 150 ,onEvent=Puse}
bb.xScale=.8
bb.yScale=.7
local bb2 = widget.newButton{ label = "Resume" , top = 250 , left = 2 ,onEvent=Resume }
bb2.xScale=.8
bb2.yScale=.7
function handleTabBarEvent(event)
if event.phase == "press" then
print ("Tab " .. event.target._id .. " is selected")
transition.to( cc, {x= -160 , y=220 , time=200} )
end
end
cc = display.newText( {text = "Shows Tap is selected" , x=-160 , y=220, fontSize = 30} )
function shows(event )
if (event.phase=="press") then
print( "shows tap is selected" )
transition.to( cc, {x= 160 , y=220 , time=400} )
end
-- body
end
-- Configure the tab buttons to appear within the bar
local progressView = widget.newProgressView
{
left = 10,
top = 320,
width = 300,
isAnimated = true
}
-- Set the progress to 50%
function progress_to_0(event)
if event.phase=="press"then
xx = math.random( 0.1 , 0.9 )
progressView:setProgress( 0.1 )
transition.to( cc, {x= -160 , y=220 , time=200} )
end
end
function progress_to_25(event)
if event.phase=="press"then
progressView:setProgress( 0.25 )
transition.to( cc, {x= -160 , y=220 , time=200} )
end
end
function progress_to_75(event)
if event.phase=="press"then
progressView:setProgress( 0.75 )
transition.to( cc, {x= -160 , y=220 , time=200} )
end
end
function progress_to_1(event)
if event.phase=="press"then
progressView:setProgress( 1 )
print( "shows tap is selected" )
transition.to( cc, {x= 160 , y=220 , time=400} )
end
end
local tabButtons = {
{
label = "Tab1", -- Text of the label
selected = true, -- Default selection
size = 16, -- size of the font in the Tab
onPress = progress_to_0 -- listener attached to the Tab
},
{
label = "Tab2", -- Text of the label
size = 16, -- size of the font in the Tab
onPress = progress_to_25 -- listener attached to the Tab
},
{
label = "Tab3", -- Text of the label
size = 16, -- size of the font in the Tab
onPress = progress_to_75
-- listener attached to the Tab
},{label="Shows" , size=16, onPress=progress_to_1 }
}
-- Create the Tabs object
local testTabs = widget.newTabBar
{
top = -45,
width = display.contentWidth,
height = 70,
buttons = tabButtons,
}
Android is case sensitive but Windows is (generally) case insensitive. So replace bg.JPG with bg.jpg and rename file accordingly.
Note:
Use small letters for file names,
Use local variables where possible e.g. local an = display.newImage( "bg.jpg" ,150,250 )

create multiple buttons from table in lua ( Corona sdk )

I have a table which looks like this:
table =
{
{
id = 1,
name = 'john',
png = 'john.png',
descr = "..."
},
{
id = 2,
name = 'sam',
png = "sam.png",
descr = "..."
}
...
}
What function could I use to display each picture like this and make them buttons
so that when I click on their image I can open their info.
This is where I am stuck:
local buttons = display.newGroup()
local xpos = -20
local ypos = 0
local e = -1
function addpicture ()
for i=1, #table do
xpos = (xpos + 100) % 300
e = e + 1
ypos = math.modf((e)*1/3) * 100 + 100
local c = display.newImage( table[i].name, system.TemporaryDirectory, xpos, ypos)
c:scale( 0.4, 0.4 )
c.name = table[i].tvname
buttons:insert(c)
end
end
function buttons:touch( event )
if event.phase == "began" then
print(self, event.id)
end
end
buttons:addEventListener('touch', buttons)
addpicture()
How can I recognize which image is touched in order to go back to the persons info?
I solved my problem by adding the listener inside of the loop like this:
function addpicture ()
for i=1, #table do
xpos = (xpos + 100) % 300
e = e + 1
ypos = math.modf((e)*1/3) * 100 + 100
local c = display.newImage( table[i].name, system.TemporaryDirectory, xpos, ypos)
c:scale( 0.4, 0.4 )
c.name = table[i].tvname
buttons:insert(c)
function c:touch( event )
if event.phase == "began" then
print(self, event.id)
end
end
c:addEventListener('touch', c)
end
end
addpicture()

Tkinter Module refresh window

My program is for a hangman game and I can't get the window to refresh once the button is clicked. At least i think that is the problem Here is my code for the window and the function linked to the button, let me know if you need more code:
def game(self, num):
self.game_window = tkinter.Tk()
self.game_window.title('Hangman')
self.game_window.geometry('200x150')
self.f1 = tkinter.Frame(self.game_window)
self.f2 = tkinter.Frame(self.game_window)
self.f3 = tkinter.Frame(self.game_window)
self.f4 = tkinter.Frame(self.game_window)
self.f5 = tkinter.Frame(self.game_window)
self.f6 = tkinter.Frame(self.game_window)
self.f7 = tkinter.Frame(self.game_window)
self.f8 = tkinter.Frame(self.game_window)
self.f9 = tkinter.Frame(self.game_window)
self.num = num
word_list = ['PYTHON','SOMETHING','COMPLETELY','DIFFERENT',
'LIST','STRING','SYNTAX','OBJECT','ERROR',
'EXCEPTION','OBJECT','CLASS','PERFORMANCE','VISUAL',
'JAVASCRIPT','JAVA','PROGRAMMING','TUPLE','ASSIGN',
'FUNCTION','OPERATOR','OPERANDS','PRECEDENCE',
'LOOPS','SENTENCE','TABLE','NUMBERS','DICTIONARY',
'GAME','SOFTWARE','NETWORK','SOCIAL','EDUCATION',
'MONITOR','COMPUTER']
shuffle = random.shuffle(word_list)
rand = random.choice(word_list)
self.word = rand.lower()
self.current = len(self.word)*'*'
self.letters = []
#self.start_lives = tkinter.Label(self.f1, text = 'You\'ve started the '
#'game with %s lives.\n'%(self.num))
#self.start_lives.pack(side = 'left')
self.lives_rem = tkinter.Label(self.f2,
text = 'Lives remaining: '+str(self.lives_left()))
self.lives_rem.pack(side = 'left')
self.guess_letter = tkinter.Label(self.f3, text = 'Guess a letter: ')
self.guess_entry = tkinter.Entry(self.f3, width = 10)
self.guess_letter.pack(side = 'left')
self.guess_entry.pack(side = 'left')
#self.f1.pack()
self.f2.pack()
self.f3.pack()
self.guess_button = tkinter.Button(self.f6,
text = 'Guess!',
command = self.update(self.guess_entry.get()))
self.guess_button.pack(side = 'left')
self.quit_game = tkinter.Button(self.f6,
text = 'Quit Game',
command = self.game_window.destroy)
self.quit_game.pack(side = 'left')
self.f6.pack()
def update(self, letter):
if letter in self.word and letter not in self.letters:
pos = self.word.index(letter)
self.current1 = list(self.current)
self.current1[pos] = letter.upper()
self.current2 = ''.join(self.current1)
self.letters.append(letter)
elif letter in self.letters:
self.already_guessed = tkinter.messagebox.showinfo('Error!',
'This letter has already '
'been guessed')
#letter is not in the word
elif letter not in self.word:
self.sorry = tkinter.Label(self.f5,
text = 'Sorry, guess again!')
self.sorry.pack(side = 'left')
self.letters.append(letter)
self.num -= 1
self.incorrect_word = tkinter.Label(self.f4,
text = 'Word: '+self.current)
self.incorrect_word.pack(side='left')
self.f5.pack()
self.f4.pack()
return self.current
These are two methods in a Hangman class.
The line that defines the guess button:
self.guess_button = tkinter.Button(self.f6, text = 'Guess!', command = self.update(self.guess_entry.get()))
requires modification. the command argument for the Button class should be a function, but this line is calling that function (which sends the output of the function as the value for the command argument). As you may see on the quit_game button definition, the self.game_window.destroy function is provided as the command, but is not called right now.
I suggest changing this line like this:
self.guess_button = tkinter.Button(self.f6, text = 'Guess!', command = self._on_guess_button_click)
and then add a new method to your class like this:
def _on_guess_button_click (self):
self.update(self.guess_entry.get())

Resources