Ver Mensaje Individual
  #1 (permalink)  
Antiguo 12/02/2009, 16:55
iozk
 
Fecha de Ingreso: mayo-2008
Mensajes: 499
Antigüedad: 15 años, 11 meses
Puntos: 1
ayuda con programa por archivos

hola tengo un problema con mi programa cuando importo mis modulos tengo problemas me sale errores que me faltan argumentos de tipo wxWindow y

Traceback (most recent call last):
File "C:/Python25/project/sample", line 2, in <module>
from tree import MyTree
File "C:\Python25\project\tree.py", line 2, in <module>
from wxprog import prog
File "C:\Python25\project\wxprog.py", line 5, in <module>
from prop import Caja
File "C:\Python25\project\prop.py", line 2, in <module>
from tree import MyTree
ImportError: cannot import name MyTree

mi programa principal
Código python:
Ver original
  1. import wx
  2. from tree import MyTree
  3.  
  4. import wx
  5. from tree import MyTree
  6.  
  7. class frame(wx.Frame):
  8.     def __init__(self, parent, id, title):
  9.         wx.Frame.__init__(self, parent, id, title)
  10.  
  11.         split = wx.SplitterWindow(self)
  12.         panel = wx.Panel(self)
  13.         panel.SetBackgroundColour('white')
  14.  
  15.         tree = MyTree(self)
  16.  
  17.         split.SplitVertically(panel, tree)
  18.  
  19. app = wx.App()
  20. frame(None, -1, 'Frame').Show()
  21. app.MainLoop()

modulo tree
Código python:
Ver original
  1. import wx
  2. from wxprog import prog
  3. class MyTree(wx.TreeCtrl):
  4.     '''Our customized TreeCtrl class
  5.    '''
  6.     def __init__(self, parent, id, prog):
  7.         '''Initialize our tree
  8.        '''
  9.         wx.TreeCtrl.__init__(self, parent, id)
  10.         root = self.AddRoot('Programmer')
  11.         os = self.AppendItem(root, 'Operating Systems')
  12.         pl = self.AppendItem(root, 'Programming Languages')
  13.         tk = self.AppendItem(root, 'Toolkits')
  14.         self.AppendItem(os, 'Linux')
  15.         self.AppendItem(os, 'FreeBSD')
  16.         self.AppendItem(os, 'OpenBSD')
  17.         self.AppendItem(os, 'NetBSD')
  18.         self.AppendItem(os, 'Solaris')
  19.         cl = self.AppendItem(pl, 'Compiled languages')
  20.         sl = self.AppendItem(pl, 'Scripting languages')
  21.         self.AppendItem(cl, 'Java')
  22.         self.AppendItem(cl, 'C++')
  23.         self.AppendItem(cl, 'C')
  24.         self.AppendItem(cl, 'Pascal')
  25.         self.AppendItem(sl, 'Python')
  26.         self.AppendItem(sl, 'Ruby')
  27.         self.AppendItem(sl, 'Tcl')
  28.         self.AppendItem(sl, 'PHP')
  29.         self.AppendItem(tk, 'Qt')
  30.         self.AppendItem(tk, 'MFC')
  31.         self.AppendItem(tk, 'wxPython')
  32.         self.AppendItem(tk, 'GTK+')
  33.         self.AppendItem(tk, 'Swing')

si me pudieran decir como hacerle porque ya intente muchas cosas y ponerle dos clases en un mismo archivo

asi

Código python:
Ver original
  1. import wx
  2.  
  3. class Editor(wx.TextCtrl):
  4.     def __init__(self, id, name, style):
  5.         wx.TextCtrl(self, -1, name, style = wx.TE_RICH|wx.HSCROLL|wx.TE_MULTILINE)
  6.         self.SetInsertionPoint(0)
  7.         points = self.GetFont().GetPointSize()
  8.         f = wx.Font(points + 2, wx.MODERN, wx.NORMAL, wx.BOLD, False)
  9.         self.SetStyle(13, 12, wx.TextAttr("White", wx.NullColour, f))
  10.         self.SetBackgroundColour('black')
  11.         text = wx.ScrolledWindow(self, -1)
  12.         text.SetScrollbars(1, 1, 600, 400)
  13.  
  14. class frame(wx.Frame):
  15.     def __init__(self, parent, id, title):
  16.         wx.Frame.__init__(self, parent, id, title)
  17.  
  18.         split = wx.SplitterWindow(self)
  19.         panel = wx.Panel(self)
  20.         panel.SetBackgroundColour('white')
  21.  
  22.         tree = Editor(self)
  23.  
  24.         split.SplitVertically(panel, tree)
  25.  
  26. app = wx.App()
  27. frame(None, -1, 'Frame').Show()
  28. app.MainLoop()

aqui me dice le faltan 4 argumentos 2 'given' en la linea 22