v14 ControlProgress does not appear on WindowDialog
#1
Hey,

I am a beginner with python and kodi programming, so i need some help.
Yesterday i discovered the WindowDialog class, and did some things. now i wanted to add a ControlProgress, but it does not appear and there are also no fail messages in the log.
Here my code (only the class for WindowDialog):
Code:
class MainClass(xbmcgui.WindowDialog):
    def __init__(self):    
        self.button = xbmcgui.ControlButton (1000, 600, 200, 50, 'Close', font='font14')
        self.addControl(self.button)
        
        self.progress = xbmcgui.ControlProgress(100, 250, 125, 75)
        self.addControl(self.progress)
    
    def onControl(self, control):
        if control == self.button:
            self.close()

mydisplay = MainClass()
mydisplay .doModal()
del mydisplay

Please help me Smile
Reply
#2
you need to put the addControl() calls into MainClass.onInit().
Also remove the space from mydisplay .doModal()

EDIT: I think i misunderstood. I´m not too familiar with adding controls via Python, for most stuff it´s more powerful and more convenient to "load" an xml file with all those controls already defined.
--> MainClass('xmlfile.xml', ADDON_PATH)
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#3
(2015-06-10, 18:56)phil65 Wrote: you need to put the addControl() calls into MainClass.onInit().
Also remove the space from mydisplay .doModal()

EDIT: I think i misunderstood. I´m not too familiar with adding controls via Python, for most stuff it´s more powerful and more convenient to "load" an xml file with all those controls already defined.
--> MainClass('xmlfile.xml', ADDON_PATH)

It also not appeared, can you give me an example for loading controls with xml?
Reply
#4
(2015-06-10, 19:04)momly Wrote:
(2015-06-10, 18:56)phil65 Wrote: you need to put the addControl() calls into MainClass.onInit().
Also remove the space from mydisplay .doModal()

EDIT: I think i misunderstood. I´m not too familiar with adding controls via Python, for most stuff it´s more powerful and more convenient to "load" an xml file with all those controls already defined.
--> MainClass('xmlfile.xml', ADDON_PATH)

It also not appeared, can you give me an example for loading controls with xml?

just look into the source code of any add-on which does something similar.
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#5
2 momly

Your code is correct, but ControlProgress seems to be broken. Developing PyXBMCt I've experimented with available Controls and could not make it work even with a full set of necessary textures, so I did not include ControlProgress in PyXBMCt.

Anyway, even if ControlProgress worked, there's still problem with updating it in real time. You'd need to separate your code into different threads.

If you need to display a progress of some process, you can use DialogProgress. It's automatically starts in a separate thread and you can easily work with it from your main program.
Reply
#6
(2015-06-11, 11:12)Roman_V_M Wrote: Your code is correct, but ControlProgress seems to be broken. Developing PyXBMCt I've experimented with available Controls and could not make it work even with a full set of necessary textures, so I did not include ControlProgress in PyXBMCt.

Yeah, on the Android build I could see a bugy progress control. Anyway, I now use WindowXML, after searching google to death because there aren't any good guides, which work perfect.

(2015-06-11, 11:12)Roman_V_M Wrote: Anyway, even if ControlProgress worked, there's still problem with updating it in real time. You'd need to separate your code into different threads.

I need to do that, can you explaine how to use different threads (example)? My first keyword was "timer", but it doesn't work here.
Reply
#7
(2015-06-14, 19:17)momly Wrote:
(2015-06-11, 11:12)Roman_V_M Wrote: Anyway, even if ControlProgress worked, there's still problem with updating it in real time. You'd need to separate your code into different threads.

I need to do that, can you explaine how to use different threads (example)? My first keyword was "timer", but it doesn't work here.

Thread programming is a rather advanced topic to be explained in a single form post. I'd recommend to search for available docs/tutorials for Python threading. Anyway, as I said, DialogProgress works in a separate thread by design, so you don't need to bother with organizing threads yourself.
Reply

Logout Mark Read Team Forum Stats Members Help
ControlProgress does not appear on WindowDialog0