Python Forum
Configure label from different class
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Configure label from different class
#2
Okay several things wrong from what I can see
  1. within the Class Setup you instantiate the Class hhelp within the help() method as "bb"
  2. when you instantiate Class hhelp as "bb" you never anchor it to the Setup Class using "self."
  3. You call both buttons "self.button" which really means you only have one button that is performing that
    second function (as it was the last assignment made) but we have already established that the first button is
    what instantiates that class that the second button calls
I would strongly suggest instantiating hhelp as part of the Setup Class __init__ otherwise you might
encounter errors because someone presses the 2nd button first -- I would definitely state that you need to
name your 2 buttons something different like self.btnOpen1 and self.btnOpen2 but it would be even better to
name them more appropriately based on what they do. If you trying to have the button do two different things
then you would have the button call a function that then called whatever functionality you wanted it to perform
self.btnOpen = Button(self.root, command=self.DoOneOfThese)

def DoOneOfThese()
    if self.YourCriterion:
        self.help()
    else:
        self.change_background_class_hhelp()
Reply


Messages In This Thread
Configure label from different class - by storzo - Aug-16-2019, 10:52 PM
RE: Configure label from different class - by Denni - Aug-19-2019, 01:30 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question [Tkinter] How to configure scrollbar dimension? water 6 3,653 Jan-03-2021, 06:16 PM
Last Post: deanhystad
Question [Tkinter] Can I configure 'tab' widgets state to 'disabled'? water 2 3,741 Jan-02-2021, 08:29 PM
Last Post: water

Forum Jump:

User Panel Messages

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