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
import wx from tree import MyTree import wx from tree import MyTree class frame(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title) split = wx.SplitterWindow(self) panel = wx.Panel(self) panel.SetBackgroundColour('white') tree = MyTree(self) split.SplitVertically(panel, tree) app = wx.App() frame(None, -1, 'Frame').Show() app.MainLoop()
modulo tree
Código python:
Ver original
import wx from wxprog import prog class MyTree(wx.TreeCtrl): '''Our customized TreeCtrl class ''' def __init__(self, parent, id, prog): '''Initialize our tree ''' wx.TreeCtrl.__init__(self, parent, id) root = self.AddRoot('Programmer') os = self.AppendItem(root, 'Operating Systems') pl = self.AppendItem(root, 'Programming Languages') tk = self.AppendItem(root, 'Toolkits') self.AppendItem(os, 'Linux') self.AppendItem(os, 'FreeBSD') self.AppendItem(os, 'OpenBSD') self.AppendItem(os, 'NetBSD') self.AppendItem(os, 'Solaris') cl = self.AppendItem(pl, 'Compiled languages') sl = self.AppendItem(pl, 'Scripting languages') self.AppendItem(cl, 'Java') self.AppendItem(cl, 'C++') self.AppendItem(cl, 'C') self.AppendItem(cl, 'Pascal') self.AppendItem(sl, 'Python') self.AppendItem(sl, 'Ruby') self.AppendItem(sl, 'Tcl') self.AppendItem(sl, 'PHP') self.AppendItem(tk, 'Qt') self.AppendItem(tk, 'MFC') self.AppendItem(tk, 'wxPython') self.AppendItem(tk, 'GTK+') 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
import wx class Editor(wx.TextCtrl): def __init__(self, id, name, style): wx.TextCtrl(self, -1, name, style = wx.TE_RICH|wx.HSCROLL|wx.TE_MULTILINE) self.SetInsertionPoint(0) points = self.GetFont().GetPointSize() f = wx.Font(points + 2, wx.MODERN, wx.NORMAL, wx.BOLD, False) self.SetStyle(13, 12, wx.TextAttr("White", wx.NullColour, f)) self.SetBackgroundColour('black') text = wx.ScrolledWindow(self, -1) text.SetScrollbars(1, 1, 600, 400) class frame(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title) split = wx.SplitterWindow(self) panel = wx.Panel(self) panel.SetBackgroundColour('white') tree = Editor(self) split.SplitVertically(panel, tree) app = wx.App() frame(None, -1, 'Frame').Show() app.MainLoop()
aqui me dice le faltan 4 argumentos 2 'given' en la linea 22