All Questions
68
questions
0
votes
0
answers
31
views
How am I able to change tkinter widgets variable inside a function without the global keyword? [duplicate]
import tkinter
def why():
global label_text
label_text = ("How I am able to access 'label' and 'root' which are global variables, without global keyword?\n"
"...
0
votes
0
answers
23
views
An imported file that Loads and saves values to Tkinter variables to and from a pickle file
I am wanting to make a script (that is re-usable on all of my python projects) that loads and saves values to all existing Tkinter variables to/from a pickle file. I could easily move the load and ...
-1
votes
2
answers
57
views
Why function don't change a var
I tired to change the expression variable within a function. And i used the global word in the function but it still don't working. This is a tkinter porblem. Please help.
Here is the part of the code
...
0
votes
0
answers
71
views
Is there any missing code to get the output?
I'm developing a python's mini project using random module. I also added tkinter as GUI.
So, the script is The task is to create a script that generates a random number between a fixed range, and if ...
0
votes
1
answer
274
views
Global variable in python with image processing
how can i make vehicle_count as a global variable so i can call it on the file class it has a use of car counting with opencv
class Vehicle_Counting:
def __init__(self, window):
self....
0
votes
1
answer
94
views
Tkinter: Global in function does not seem to work on button click
I want the var state to be True after clicking the button.
This is the code
from tkinter import *
root = Tk()
def value():
global state
state = True
print(state)
...
0
votes
3
answers
61
views
Python Tkinter Problem (with global keyword)
I have given two files in Python:
file1.py:
from file2 import *
root = None
create_window_middle(400, 400)
label1 = tk.Label(root, text="Label 1")
label1.pack()
label2 = tk.Label(root, ...
0
votes
0
answers
77
views
delete a button from a different function (python tkinter)
I am writing a snake program which has a leaderboard built in. When someone clicks the leaderboard button, I would want my program to delete everything in the canvas (including the play_again and die ...
0
votes
1
answer
105
views
Tkinter global modules
Hello!
I've heard that the global function can lead to problems especially when debugging, so I'd like to know if anyone has an idea how to write the following python code the best way possible. ...
0
votes
0
answers
45
views
getting an error when trying to use place_forget on a frame widget(Tkinter)
When I try to call .place_forget, it gives me the following error:
newframe.place_forget()
NameError: name 'newframe' is not defined
I do not know what is causing the error, as I made the variable ...
1
vote
1
answer
37
views
With one variable make another one bigger but make the first one smaller
I want to make it so when I upgrade the level goes up but the clicks go down by the upgrade cost but when I do it gives me this error:
line 19, in upgrade
if clicks >= 10: UnboundLocalError: ...
0
votes
1
answer
314
views
tkinter, or function to pass filename into variable for use in other function
My code below is to be used in a GUI that has two buttons. One to ask the user to locate a txt file, the other to run a function using that file to clean the data.
However I cannot figure out how to ...
0
votes
1
answer
839
views
I declare a global variable inside a function, but outside the function it is "undefined", it also says inside the function that it is undefined
I made a variable inside the function, but it says "Global variable is undefined at the 'module level' ". Maybe my variable is a different type, but I don't know how to fix it. After I use ...
0
votes
1
answer
20
views
(Python) trying to write a Function to reads a dataframe (from excel) and then loop same number of rows into check boxes when the application loads
But I am having a hard time being able to figure out how to .get() from tkinter to call the corresponding value when a particular check box is clicked.
class overview:
def __init__(self,m):
self....
0
votes
1
answer
53
views
tkinter/datetime/weekday/dictionary/ type error : strptime() argument 1 must be str, not entry
In function (def wky(event)), without 'global ab', it happens next error
message : 'UnboundLocalError'. And then, I used that words(global ab).
But, I wonder that that words is necessary? Without ...