Python Forum
WHY? General Python Programming question moved to GUI.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
WHY? General Python Programming question moved to GUI.
#1
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
Reply
#2
(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.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
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.
Recommended Tutorials:
Reply
#4
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Why was my post deleted/moved ? Hadad 6 3,072 Jul-20-2019, 09:40 PM
Last Post: DeaD_EyE
  post getting moved to news and discussions without any notification or explanation? johsmi96 2 2,726 May-08-2019, 06:22 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

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