Talk:Paths/Developer/Creating plasmoids with scripts

From KDE TechBase
Revision as of 01:21, 18 January 2009 by Tampakrap (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Errors in Python code

There are numerous errors in the Python script. Running it gives:

 File "main.py", line 14
   self.svg = Plasma::Svg.new(@top.applet())
                    ^
SyntaxError: invalid syntax

Which is of course quite obvious, since the :: is a C++ operator and not Pthon. The @top is also not Python syntax. Furthermore, the call to 'preparePainter' is done before the function itself is defined, which is also impossible.

Cheers, Sybren Stüvel -- sybren AT stuvel DOT eu


Actually it's not a c++ call, and you're right, @top is not python either. They're both ruby syntax. I've obviously been playing to much with ruby lately. Furthermore, the call to preparePainter is fine, it's defined on the object. Objects are fully aware of all their own members whether defined before or after the function calling them. Anyway, the script is fixed. It does work now.. tested in 4.2Rc1.