Original Post
Hi all!
This may be strange, but I've got a conundrum...
I'm working on a GUI system to be used in an game I'm developing. I'm using a MVC design scheme for it, and, for all intents and purposes, it's working very well, however, one key issue is in "themeing" the widgets. I want to allow for users of the GUI to theme not just the colors, but how individual widgets are rendered.
Basically, I want to give the users access to a subset of python so if a user were to take my game (or, if a developer used the GUI library itself) they can use this python subset to write a script defining how a widget is to be rendered.
(And by "Widget" I mean base elements such as FRAME, BUTTON, SLIDER, etc etc)
To this end, I've been doing some research on Python's eval function. On the surface, it looks like exactly what I need down to the ability to choose what objects are available for the evaluated render code. My fear is it looks too good. Not to mention the general consensus of "NO! EVAL IS TOTALLY AND ABSOLUTELY UNSAFE".
Is Eval what I need or is there a better way of using Python as a scripting language within a python app?
This may be strange, but I've got a conundrum...
I'm working on a GUI system to be used in an game I'm developing. I'm using a MVC design scheme for it, and, for all intents and purposes, it's working very well, however, one key issue is in "themeing" the widgets. I want to allow for users of the GUI to theme not just the colors, but how individual widgets are rendered.
Basically, I want to give the users access to a subset of python so if a user were to take my game (or, if a developer used the GUI library itself) they can use this python subset to write a script defining how a widget is to be rendered.
(And by "Widget" I mean base elements such as FRAME, BUTTON, SLIDER, etc etc)
To this end, I've been doing some research on Python's eval function. On the surface, it looks like exactly what I need down to the ability to choose what objects are available for the evaluated render code. My fear is it looks too good. Not to mention the general consensus of "NO! EVAL IS TOTALLY AND ABSOLUTELY UNSAFE".
Is Eval what I need or is there a better way of using Python as a scripting language within a python app?