Python Forum
[PyQt] Managing variables accross a multiple module GUI
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyQt] Managing variables accross a multiple module GUI
#11
i disagree. but then with 40 years of programming experience, i know how to do global and shared variables safely. but if you want to avoid them, by all means avoid them. but you still want some way to communicate between modules. what are you thinking about? messages? events?

i think Denni's point might be if you need to communicate between modules, you have a bad design, somehow. each method, or at least each class should be autonomous as much as you can do it. it should be designed to be something created separate and apart from all the others you happen to be using together in a script that needs them. when designing something big you readily see things you can encapsulate as a function or class. but thinking about it in the context of that big project can result in components that are not autonomously designed. so you need to have another look at your modules and why there is a need to communicate between them. if you can make them autonomous, you should, as that will make each one cleaner.

global and shared variables do exist for a reason. they can be design shortcuts. sometimes the goal is to get something working soon without the delays of good design. but, more experience doing good design lets you do them quicker to the point for many projects the time is the same and/or you have more reusable (because it was well designed) code you can just drop in.

can you describe a couple of modules that need to communicate and let us see how you are doing the design?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
RE: Managing variables accross a multiple module GUI - by Skaperen - Jul-06-2019, 01:00 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question [Tkinter] Defining a self made module's function to interact with the main .py variables? Gilush 9 4,490 Jun-08-2020, 09:08 AM
Last Post: Gilush

Forum Jump:

User Panel Messages

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