Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

View Variables in use

If you have a question or need help, this is the place to be.
Post Reply
Phil
Experienced User
Posts: 111
Joined: Tue Apr 15, 2014 10:42 am
Location: Merseyside, UK

View Variables in use

Post by Phil »

Hi
Is there anyway to view a list of what eg.globals variables are defined and what their values are?

thanks

Phil
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: View Variables in use

Post by Pako »

Phil wrote:Is there any way to view a list of what eg.globals variables are defined and what their values are?
The answer to your question is yes, there is any way.
You would possibly even want to know how to do it.
Well - here is one possible solution:

Code: Select all

def getGlobalVariables():
    keys = list(eg.globals.__dict__.keys())
    keys.remove('__builtins__')
    keys.remove('eg')
    for key in sorted(keys):
        print key,"=",repr(eg.globals.__dict__[key])
getGlobalVariables()
Pako
Phil
Experienced User
Posts: 111
Joined: Tue Apr 15, 2014 10:42 am
Location: Merseyside, UK

Re: View Variables in use

Post by Phil »

Excellent, thank you and even some comedy thrown in for good measure! :D
kkl
Experienced User
Posts: 317
Joined: Wed May 04, 2011 9:32 pm

Re: View Variables in use

Post by kkl »

Another option, if you just want to browse through all of the variables, is to use the menu item Help...Python Shell. This will open a PyCrust interface and you can browse through the EG variables in the Namespace tab.
Post Reply