Release PyXBMCt: a Python framework for simple creating UI for XBMC addons
#59
(2014-03-19, 14:54)Aweponken Wrote:
(2014-03-19, 12:03)Roman_V_M Wrote: That depends on your preferences. Coding style is completely up to you, as long as it works and supportable.
Oh, okay!
So I'm trying to convert the radiobutton from the demo version.
The original code looks like this:

Should be something like(?):
PHP Code:
window.connect(radiobuttonradio_update

This should work, though personally I think that it is not too good that your function refers to an object (radiobutton) from outside (global?) scope. Usually this means bad code style. For good code style your function should communicate with the rest of your program only via its interface, i.e. function call signature and return/yield statement.
If you really don't want to use OOP then it should be something like this:
PHP Code:
def radio_update(radiobutton):
        
# Update radiobutton caption on toggle
        
if radiobutton.isSelected():
            
radiobutton.setLabel('On')
        else:
            
radiobutton.setLabel('Off'
and you need to connect the function call via lambda.
Reply


Messages In This Thread
RE: PyXBMCt: a Python framework for simple creating UI for XBMC addons - by Roman_V_M - 2014-03-19, 15:38
Adding simple child window - by MGA1500 - 2014-12-20, 16:20
Little Guidance Please - by chris.jones1989 - 2016-10-25, 03:05
Logout Mark Read Team Forum Stats Members Help
PyXBMCt: a Python framework for simple creating UI for XBMC addons4