Newb help - best way to setup log/DB viewing app

15 views
Skip to first unread message

Jacob Martin

unread,
Feb 6, 2016, 5:51:23 PM2/6/16
to Kivy users support
I'm working on a CLI app that uses an existing REST API. It's hard to visualize where it's at in its process from just watching the debug log so I'm learning Kivy to provide some visualization. I'd like to show the state of each submitted REST job, which I'm storing in a local sqlite DB.

I'm completely new to GUI programming and Kivy, but I'm thinking about using a vertical BoxLayout with select fields from a local sqlite DB displayed (updated in near real-time, color coded to indicate status = running, complete, etc.) in the first row and displaying a scrollable view of the debug log in the second row, possibly using ScrollView. Is that the best option? Has anyone who has done something similar have any recommendations for the best way to display a running log file or things to watch out for?

Thanks in advance!

Jacob

Jacob Martin

unread,
Feb 6, 2016, 8:57:07 PM2/6/16
to Kivy users support
I'm trying to get a feel for how Kivy works and I'm trying to update the text of a Label on a scheduled interval using a widget ID reference, but I'm getting an exception. Here's the sample code:


from kivy.app import App
from kivy.uix.label import Label
from kivy.clock import Clock


class MyApp(App):

    def build(self):
        l = Label(text='Hello world', id='label1')
        Clock.schedule_interval(self.callback, 1)
        return l

    def callback(self, dt):
        self.root.ids.label1.text = 'asdfasdfasdf'


if __name__ == '__main__':
    a = MyApp()
    a.run()



That generates this exception:
 Traceback (most recent call last):
   File "ktest.py", line 23, in <module>
     a.run()
   File "C:\Python27\lib\site-packages\kivy\app.py", line 828, in run
     runTouchApp()
   File "C:\Python27\lib\site-packages\kivy\base.py", line 487, in runTouchApp
     EventLoop.window.mainloop()
   File "C:\Python27\lib\site-packages\kivy\core\window\window_sdl2.py", line 619, in mainloop
     self._mainloop()
   File "C:\Python27\lib\site-packages\kivy\core\window\window_sdl2.py", line 362, in _mainloop
     EventLoop.idle()
   File "C:\Python27\lib\site-packages\kivy\base.py", line 327, in idle
     Clock.tick()
   File "C:\Python27\lib\site-packages\kivy\clock.py", line 515, in tick
     self._process_events()
   File "C:\Python27\lib\site-packages\kivy\clock.py", line 647, in _process_events
     event.tick(self._last_tick, remove)
   File "C:\Python27\lib\site-packages\kivy\clock.py", line 406, in tick
     ret = callback(self._dt)
   File "ktest.py", line 18, in callback
     self.root.ids.label1.text = 'asdfasdfasdf'
   File "kivy\properties.pyx", line 757, in kivy.properties.ObservableDict.__getattr__ (kivy\properties.c:11882)
 AttributeError: 'super' object has no attribute '__getattr__'



What am I doing wrong?

Thanks!
Jacob


Reply all
Reply to author
Forward
0 new messages