2013-11-17, 16:54
Hello,
I wrote a basic python script to provide a gui front end, that creates a file used as a flag following the examples in the HOW-TO:Write Python Scripts for XBMC. The script works in frodo but fails in gotham. The error lines produced in the logs are :
/some/pathTopluginCode/default.py", line 73, in <module>
mydisplay = MyClass()
TypeError: function takes exactly 1 argument (0 given)
-->End of Python script error report<--
The python code is below. This thread is about the same error, but I can't seem to figure out how to apply the solution to my code....that in itself highlights how little I actually know of python programming. Any suggestions on how to clear the error?
Thanks,
I wrote a basic python script to provide a gui front end, that creates a file used as a flag following the examples in the HOW-TO:Write Python Scripts for XBMC. The script works in frodo but fails in gotham. The error lines produced in the logs are :
/some/pathTopluginCode/default.py", line 73, in <module>
mydisplay = MyClass()
TypeError: function takes exactly 1 argument (0 given)
-->End of Python script error report<--
The python code is below. This thread is about the same error, but I can't seem to figure out how to apply the solution to my code....that in itself highlights how little I actually know of python programming. Any suggestions on how to clear the error?
Thanks,
Code:
import xbmc, xbmcgui
import os, sys
#get actioncodes from https://github.com/xbmc/xbmc/blob/master/xbmc/guilib/Key.h
ACTION_PREVIOUS_MENU = 10
import datetime
now = datetime.datetime.now()
fpath = xbmc.translatePath('special://home/')
tfilename =os.path.join( fpath, "keep_media_flags" )
class MyClass(xbmcgui.Window):
def __init__(self):
self.strActionInfo = xbmcgui.ControlLabel(100, 120, 500, 300, '', 'font13', '0xFFFF00FF')
self.addControl(self.strActionInfo)
self.strActionInfo.setLabel('Push BACK (or Esc key) to quit')
self.button0 = xbmcgui.ControlButton(250, 200, 500, 50, "Press to disable writes to VideoDatabase")
self.addControl(self.button0)
self.button1 = xbmcgui.ControlButton(750, 200, 500, 50, "Press to enable writes to VideoDatabase")
self.addControl(self.button1)
self.button0.controlRight(self.button1)
self.button1.controlLeft(self.button0)
def onAction(self, action):
if action == ACTION_PREVIOUS_MENU:
self.close()
def onControl(self, control):
if control == self.button0:
#
# create and populate the media flags file with timestamp
#
outfile = open(tfilename, 'a')
outfile.write( '#####################\n' )
outfile.write( now.strftime("%Y-%m-%d %H:%M \n") )
outfile.write( '#####################\n' )
self.message('You disabled VideoPlayer writes to the VideoDatabase ')
if control == self.button1:
#
# remove the media flags file
#
os.remove( tfilename )
self.message('You are back to the xbmc default of enabled \n DVDPlayer writes to the VidoeDatabase')
def message(self, message):
dialog = xbmcgui.Dialog()
dialog.ok(" My message title", message)
mydisplay = MyClass()
mydisplay .doModal()
del mydisplay