Python Forum
How to pass variables from one class to another
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to pass variables from one class to another
#18
Everything works from post #16. I also need to use this code:

class GetInterestingInfo(): # assume this class: class MyToolBar(mpl_qt.NavigationToolbar2QT):
    def get_info(self):
        self.device.read_data()
        self.process_raw_data()
        return self.processed_data
 
class UseInterestingInfo():
    def use_info(self, interesting_info):
        pass
 
 
x = GetInterestingInfo()
y = UseInterestingInfo()
 
y.use_info(x.get_info()):
but instead of class GetInterestingInfo I have put class MyToolBar(mpl_qt.NavigationToolbar2QT). Please look post #11. How do I call it in this command:

x = MyToolBar() 
I cannot call it like this, because it needs arguments inside the parentheses. I cannot also put self.plotCanvas, self. So what do I put inside?

(The idea is to send values from class MyToolBar to the class UseInterestingInfo)
Reply


Messages In This Thread
RE: How to pass variables from one class to another - by hobbyist - Oct-01-2021, 12:13 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Unchangeable variables in a class? Calab 12 1,577 Sep-15-2023, 07:15 PM
Last Post: deanhystad
  How to pass encrypted pass to pyodbc script tester_V 0 881 Jul-27-2023, 12:40 AM
Last Post: tester_V
  Class variables and Multiprocessing(or concurrent.futures.ProcessPoolExecutor) Tomli 5 3,917 Nov-12-2021, 09:55 PM
Last Post: snippsat
  Acess variables from class samuelbachorik 3 1,915 Aug-20-2021, 02:55 PM
Last Post: deanhystad
Exclamation win32com: How to pass a reference object into a COM server class Alfalfa 3 4,922 Jul-26-2021, 06:25 PM
Last Post: Alfalfa
  Do I have to pass 85 variables to function? Milfredo 10 4,335 Sep-26-2020, 10:13 PM
Last Post: Milfredo
  Pass by object reference when does it behave like pass by value or reference? mczarnek 2 2,572 Sep-07-2020, 08:02 AM
Last Post: perfringo
  Class variables menator01 2 2,024 Jun-04-2020, 04:23 PM
Last Post: Yoriz
  Question about naming variables in class methods sShadowSerpent 1 2,025 Mar-25-2020, 04:51 PM
Last Post: ndc85430
  Pass by reference vs Pass by value leodavinci1990 1 2,224 Nov-20-2019, 02:05 AM
Last Post: jefsummers

Forum Jump:

User Panel Messages

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