新手问题请教 TypeError: script() takes exactly 1 argument (2 give)
# -*- coding: utf-8 -*-
import wx
import wx.xrc
import _winreg
from wx import App, CAPTION
from wxPython._wx import NULL
class Script ( wx.Frame ):
def __init__( self, parent ):
wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"Script Tool", pos = wx.DefaultPosition, size = wx.Size( 320,600 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )
.
.
.
self.Bind(wx.EVT_MENU, self.OnAbout, self.m_menuItem4)
self.Bind(wx.EVT_BUTTON, self.script, self.m_button4)
self.Centre( wx.BOTH )
def script(self):
b = self.get_desktop()
print b
#m_sctipt = open((self.get_desktop()+'\\'+self.m_textCtrl1.GetValue()+'.txt'),'w')
#m_sctipt.close()
def get_desktop(self):
key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER,r'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders',)
return _winreg.QueryValueEx(key, "Desktop")[0]'''
app = wx.App()
script = Script(None)
script.Show()
app.MainLoop()
省略部分界面的代码,点击按钮时出现错误提示:
TypeError: script() takes exactly 1 argument (2 given)
b = self.get_desktop()调用时传递了那两个参数?
非常谢谢。