Why are labels not seeing values from functions Tkinter

Questions : Why are labels not seeing values from functions Tkinter

760

I'm trying to make a program that programming prompts the user to solve an equation. I Learning want it to reset values after every try. Earhost I thought I would put a random generator most effective into a function and pass the values to wrong idea display them. But it's not working....

from tkinter import *
from tkinter _OFFSET);  import ttk
from tkinter.font import (-SMALL  families
from PIL import ImageTk, _left).offset  Image
import random

root = arrowImgView.mas  Tk()
root.geometry("610x500")
root.resizable(width=False, (self.  height=False)

def rand(): 
    global equalTo  num1
    global num2
    num1 = make.right.  random.randrange(2, 9)
    num2 = mas_top);  random.randrange(2, 9) 

bg = ImgView.  PhotoImage(file = "fon.png")
label1 = ReadIndicator  Label(root, image = bg)
label1.place(x = _have  0, y = 0)

label2 = Label( root, text = .equalTo(  "Solve the equation") 
label2.pack(pady make.top  = 50)

label3 = Label(root, text = OFFSET);  num1)
label3.place(x = 280, y = (TINY_  140)

label4 = Label(root, text = .offset  num2)
label4.place(x = 310, y = mas_right)  140)

label5 = Label(root, text = ImgView.  '*')
label5.place(x = 295, y = 140)


e Indicator  = Entry(root, Read  width=50)
e.pack(pady=50)
e.get()
num3 = _have  num1 * num2

def eq():
    
    user = .equalTo(  e.get()
    int_answer = int(user)
    
 make.left     if num3 == int_answer:
        label8 *make) {  = Label(root, text = "correct")
        straintMaker  label8.place(x = 400, y = 140)
        ^(MASCon  rand()
    else:
        label8 = onstraints:  Label(root, text = "incorrect")
        mas_makeC  label8.place(x = 400, y = 140)
        [_topTxtlbl   rand()
        
button1 = (@(8));  Button(text='Check your answer', equalTo  command=eq)
button1.place(x = 250, y =  width.  200)


root.mainloop()
Total Answers 0

Top rated topics

How can I make this code generate a new line after finding Logical ID and IP Address?

Need to extract the last word in a Rust string

How to extract decimal number from string in C#

Longest common substring in R finding non-contiguous matches between the two strings

Express CANNOT POST after firebase function deployment

How make DSL query in ElasticSearch for find points on linestring?

SplashScreen not full screen when exist on Android < 12

How to get original positions of items in an intersection?

Reduce gap between bars in svg graphs

How to create table from sql file with JPA or JDBC?

How to groupBy by created column?

Why does my Mat-stepper doesn't show immediately when the page is loaded?

InAppBrowser Cordova how to send data in WebView

Bulk insert gives 0 rows affected

StylePreprocessorOptions->includePaths ignored if I use scss @use instead of @import in Angular 12.1 component styles (nx)

Javascript JSON array of objects to HTML table

Variable Length Array (VLA) in C++ compilers

How to always show dropdown below the trigger

Changing file names

Log4j upgrade in elasticsearch

How to fix the "OptimizeWarning: Covariance of the parameters could not be estimated" for Scipy.optimize curve_fit?

Changes to chef existing cookbooks and upload causing errors

Is there a way to stop `git diff-tool` when return code is non-zero from the diff-tool is non-zero

Github - How to hide a single file from repository

Greensock scrolltrigger - unusual autoscrolling and not pinning on sections

Execution failed for task ':app:mergeDebugResources'.A failure occurred while executing com.android.build.gradle.internal.res.ResourceCompilerRunnable

MongoDB - NodeJS - loosing ObjectId when serializing to JSON

How to safely extract an encrypted zip folder to a random folder, load all extracted files into memory safely delete the extracted files

Why can't TupleElementNamesAttribute be applied to tuple fields?

How to make part of text that is on an image a different color on hover

MongoDB installations - Failed to download resource "c-ares"

Flutter - nested json from API

Dash: Keep Tabs bar on top and remember where was scrolled between tabs

Is there a function that can make a string representation of any type?

Adding class based on boolean ReactJS

Json with null value deserialize issue

Multitenancy - Hibernate Persistence - Don't change SCHEMA

Is there any way to manually programatically create HttpSession in the server without neccessety of sending request?

What is Python's equivalent to 'ulimit'?

Event.layerX and event.layerY not found with cypress

I can't install from Delphi 10.3.3 Android 32/64 on Android 11 device

How to trigger the next iteration of a matrix if a condition is met - Javascript

A complex read text file

JSON Variables in .lang Files

Transform Map<String, Object> to Object using Java streams

Word count on Windows shell

Order DateTime, then group by Date (ignoring Time) + other field

Test React Form internal submit

NGINX Proxy Pass to another IP Address, preserving original URL - Getting Broken Elements (404)

Extracting date range from a messy table

Top