Bernard Lebel wrote:
> In the task I'm currently having, I have to dynamically create a
> certain number of layout elements along its logic. The number of
> elements to create changes from one execution to the next, as it is
> driven by the user input. Since properpty plugins do not support such
>
Actually, regarding inspect.getsource() that raised IOErrors:
Running it from imported module actually works!
Thanks
Bernard
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
okay here "simple" examples about why I have to define callbacks as
strings instead of code.
In XSI, one of the GUI objects that you can create is called a "custom
property". A custom property is basically a floating window in which
there are widgets. Custom properties can define a layout or not.
"Bernard Lebel" <[EMAIL PROTECTED]> wrote
> Why? Because I'm using an API (the Softimage|XSI scripting API)
> where
> I have to create a custom GUI (using that API's GUI toolkit).
>
> I have to attach a logic callback to a number of widgets that can
> change from one execution to the next.
Can y
Bernard Lebel wrote:
> Hi Kent,
>
> When try your approach, I get an IOError.
>
>
import inspect
def myFunc():
> ... print 'hello world'
> ...
>
s = inspect.getsource(myFunc)
> Traceback (most recent call last):
> File "", line 1, in ?
> File
Hi Kent,
When try your approach, I get an IOError.
>>> import inspect
>>> def myFunc():
... print 'hello world'
...
>>>
>>> s = inspect.getsource(myFunc)
Traceback (most recent call last):
File "", line 1, in ?
File "C:\Python24\lib\inspect.py", line 552, in getsource
lines, lnum = ge
"Bernard Lebel" <[EMAIL PROTECTED]> wrote
> I'm looking for a way to convert Python code into a string.
Read the file as text?
You can find the file by checking the __file__ attribute
of a module.
> Now in the same module, I'd like to take this function and convert
> it
> into a string:
If its
Bernard Lebel wrote:
> Hello,
>
> I'm looking for a way to convert Python code into a string.
>
> For example, let say I have this function:
>
> def myFunc():
> print 'hello world'
>
>
> Now in the same module, I'd like to take this function and convert it
> into a string:
>
> """def myFunc():
Bernard Lebel wrote:
> Hello,
>
> I'm looking for a way to convert Python code into a string.
>
> For example, let say I have this function:
>
> def myFunc():
> print 'hello world'
>
>
> Now in the same module, I'd like to take this function and convert it
> into a string:
>
> """def myFu
Greetings,
The following is from:
http://www.hetland.org/coding/
##
Self-Printing One-Liner
If you run this one-liner at a command prompt, it should print out a
copy of itself (write it as one continuous line, without the line
break):
python -c "x='python -c %sx=%s; print x%%(chr
Hello,
I'm looking for a way to convert Python code into a string.
For example, let say I have this function:
def myFunc():
print 'hello world'
Now in the same module, I'd like to take this function and convert it
into a string:
"""def myFunc():
print 'hello world'\n"""
Thanks
Bern
11 matches
Mail list logo