rothgar
2005-01-08, 02:00
hey everyone, i'm definatly new to scripting python and have been reading these forums for a little while now. i was trying to just lay out a user interface for a script im trying to write but it doesnt work. i really just took the great tutorial by alex and alexpoet and was making sure it would show up like i wanted it to. but when i try to run it nothing happens. just wondering if anyone can check out the script and see maybe where the error is. and i also know there was a way to see why the script was failing but i cant remember where that was in the forums. (sorta like a debug screen) if anyone can help that would be great.
import xbmc, xbmcgui
try: emulating = xbmcgui.emulating
except: emulating = false
#buttons that are defined
action_previous_menu = 10
action_select_item = 7
action_parent_dir = 9
class myclass(xbmcgui.window):
def (self):
if emulating: xbmcgui.window.(self)
self.addcontrol(xbmcgui.controlimage(0,0,720,480, background2.png))
self.stractioninfo = xbmcgui.controllabel(100,200,200,200,"","font13","0xffff00ff"
;)
self.addcontrol(self.stractioninfo)
self.stractioninfo.setlabel("push back to quit.")
#making button
self.button0 = xbmcgui.controlbutton(250, 150, 120, 30, "try")
self.addcontrol(self.button0)
self.setfocus(self.button0)
#make server list
self.list = xbmcgui.controllist(300, 250, 200, 200)
self.addcontrol(self.list)
items = ["sever 1", "sever 2", "server 3", "server 4"]
for item in items:
self.list.additem(item)
#keyboard
self.outputlabel = xbmcgui.controllabel(100, 300, 200, 200)
self.addcontrol(self.outputlabel)
keyboard = xbmc.keyboard("entered text")
keyboard.domodal()
if(keyboard.isconfirmed()):
self.outputlabel.setlabel(keyboard.gettext())
else:
self.outputlabel.setlabel("user canceled")
def onaction(self, action):
if action == action_previous_menu:
self.close()
def oncontrol(self, control):
if control == self.button0:
self.message("test")
if control == self.list:
item = self.list.getselecteditem()
self.message( "join" + item.getlabel())
def message(self, message):
dialog = xbmcgui.dialog()
dialog.ok("does not really work!!", message)
def localinfo(self)
infoip = xbmc.getipaddress()
self.stripaddress = xbmcgui.controllabel(700, 460, 200, 200, "", "font13", "0xffffffff")
self.addcontrol(self.stripaddress)
self.stripaddress.setlabel(infoip)
mydisplay = myclass()
mydisplay.domodal()
del mydisplay
umm...the tab doesnt seem to work but i really dont think that is where the error is. i've checked as much as i know but it just doesnt do anything. thanks in advance.
import xbmc, xbmcgui
try: emulating = xbmcgui.emulating
except: emulating = false
#buttons that are defined
action_previous_menu = 10
action_select_item = 7
action_parent_dir = 9
class myclass(xbmcgui.window):
def (self):
if emulating: xbmcgui.window.(self)
self.addcontrol(xbmcgui.controlimage(0,0,720,480, background2.png))
self.stractioninfo = xbmcgui.controllabel(100,200,200,200,"","font13","0xffff00ff"
;)
self.addcontrol(self.stractioninfo)
self.stractioninfo.setlabel("push back to quit.")
#making button
self.button0 = xbmcgui.controlbutton(250, 150, 120, 30, "try")
self.addcontrol(self.button0)
self.setfocus(self.button0)
#make server list
self.list = xbmcgui.controllist(300, 250, 200, 200)
self.addcontrol(self.list)
items = ["sever 1", "sever 2", "server 3", "server 4"]
for item in items:
self.list.additem(item)
#keyboard
self.outputlabel = xbmcgui.controllabel(100, 300, 200, 200)
self.addcontrol(self.outputlabel)
keyboard = xbmc.keyboard("entered text")
keyboard.domodal()
if(keyboard.isconfirmed()):
self.outputlabel.setlabel(keyboard.gettext())
else:
self.outputlabel.setlabel("user canceled")
def onaction(self, action):
if action == action_previous_menu:
self.close()
def oncontrol(self, control):
if control == self.button0:
self.message("test")
if control == self.list:
item = self.list.getselecteditem()
self.message( "join" + item.getlabel())
def message(self, message):
dialog = xbmcgui.dialog()
dialog.ok("does not really work!!", message)
def localinfo(self)
infoip = xbmc.getipaddress()
self.stripaddress = xbmcgui.controllabel(700, 460, 200, 200, "", "font13", "0xffffffff")
self.addcontrol(self.stripaddress)
self.stripaddress.setlabel(infoip)
mydisplay = myclass()
mydisplay.domodal()
del mydisplay
umm...the tab doesnt seem to work but i really dont think that is where the error is. i've checked as much as i know but it just doesnt do anything. thanks in advance.