Python Forum

Full Version: WHY? General Python Programming question moved to GUI.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Esteemed Administrators and Moderators:

I just posted a very generic Python Programming question which was immediately moved to the "GUI" section. Yes, it DOES 'mention' TKinter, but ONLY because that's what I am incidentally using in my application and was easy to cut and paste into the post.

Why is "using globals in modules" not a GENERAL Python question?

I'm assuming that I will get far less exposure in GUI than I would in Python "General Coding Help", and I not only want an answer for myself, but also to allow other newbies to encounter general programming techniques.

Thank you for your great work in administering this forum.
Art in Carlisle, PA USA
(May-09-2019, 01:10 PM)Webtest Wrote: [ -> ]I'm assuming that I will get far less exposure in GUI than I would in Python Programming, and I not only want an answer for myself, but also to allow other newbies to encounter general programming techniques.

Don't worry. It will get exactly the same exposure in GUI. And the problem is not with using globals in general context, but in GUI (Tkinter) context. There you will get really focused answer and possibly better approach to organise your overall code. Because the real acute problem with your code is the structure, not how to use globals.

All that said, IMHO the only good answer is - don't use globals.
Even if it was in general coding help, users not experienced in tkinter would mostly likely pass by your post due to the high amount of tkinter code. The better way to get higher traffic to your thread would be to rewrite the code to not use tkinter, but still illustrate the same problem with no GUI or 3rd party libraries.
Thank you buran and metulburr !

I spent as much time as I had available paring down the code to a workable minimum.

I did a LOT of searching, and although I did find many caveats regarding Globals, I did find this, which works extremely well in my program, is ELEGANT, sanctioned with documentation, and GENERAL. It could be useful to many applications.

Python Software Foundation
Programming FAQ: How do I share global variables across modules?

I updated my post in the GUI section to implement this suggested method.

Blessings in abundance, all the best, & ENJOY!
Art in Carlisle, PA USA