Python Forum
[PyGUI] Python 3.8.1 Tkinter Widget stete change
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyGUI] Python 3.8.1 Tkinter Widget stete change
#3
Thank You Larz60+!
I'm new in python.
You are right about the incomprehensibility of what I wrote.
I try to simplify:
from tkinter import *

import math
import numpy as np

# omissis...

def verifica(event=None):
    val1 = v1.get() * int(e1.get()) * 50
    val2 = v2.get() * int(e2.get()) * 20
    val3 = v3.get() * int(e3.get()) * 10
    val4 = v4.get() * int(e4.get()) * 5
    print (val1,val2,val3,val4)
    somma=val1+val2+val3+val4
    print (somma)
    valtot=int(e0.get())    
    if somma > valtot:
       b0.config(state = 'disabled') #<--- this doesn't work!!!
    else:
       b0.config(state=NORMAL) #<--- this doesn't work!!!


b0 = Button(gui, text="Split", state='normal', command=callback).place(x=100, y=155, height=20, width=100)
b1 = Checkbutton(gui, text="fix", state='disabled', variable=v1, command=verifica).place(x=210, y=35, height=20, width=100)
The problem lies in the fact that once the widgets (in this case b0 and b1) are set, I can no longer change their state (normal / disabled).
Have a nice day!
Reply


Messages In This Thread
RE: Python 3.8.1 Tkinter Widget stete change - by sasiap - Feb-14-2020, 08:12 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  TKinter Widget Attribute and Method Quick Reference zunebuggy 3 964 Oct-15-2023, 05:49 PM
Last Post: zunebuggy
  [Tkinter] Tkinter don't change the image DQT 2 1,716 Jul-22-2022, 10:26 AM
Last Post: menator01
  [Tkinter] The Text in the Label widget Tkinter cuts off the Long text in the view malmustafa 4 5,266 Jun-26-2022, 06:26 PM
Last Post: menator01
  Tkinter - How can I change the default Notebook border color? TurboC 5 14,979 May-23-2022, 03:44 PM
Last Post: bigmac
  Can't get tkinter button to change color based on changes in data dford 4 3,518 Feb-13-2022, 01:57 PM
Last Post: dford
  Tkinter Exit Code based on Entry Widget Nu2Python 6 3,157 Oct-21-2021, 03:01 PM
Last Post: Nu2Python
  tkinter change the text of the checkbox zazas321 1 3,946 Sep-17-2021, 06:19 AM
Last Post: zazas321
  tkinter text widget word wrap position chrisdb 6 7,734 Mar-18-2021, 03:55 PM
Last Post: chrisdb
  Tkinter - How can I extend a label widget? TurboC 2 2,876 Oct-13-2020, 12:15 PM
Last Post: zazas321
  Tkinter menu font size -method to change tonycat 2 7,978 Oct-11-2020, 02:43 AM
Last Post: tonycat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020