help with loadfile() in stc

hi i cant make that read the files with this LoadFile() method i got
the files separetly like the styledtextctrl and the tree and tell that
got 1 argument (2 given) and i cant do that the styled text appears in
a new page of auinotebook

                self.count += 1
                self.notebook = wx.Window.FindFocus()
                self.editor = stxt(self.notebook, -1)
                self.editor.LoadFile(self.GetItemText(item))# here the
line that not read
                self.notebook.AddPage(self.editor, "File
%d"%self.count)

Hi,

···

On Feb 27, 2010, at 12:16 PM, iozk_Live wrote:

hi i cant make that read the files with this LoadFile() method i got
the files separetly like the styledtextctrl and the tree and tell that
got 1 argument (2 given) and i cant do that the styled text appears in
a new page of auinotebook

               self.count += 1
               self.notebook = wx.Window.FindFocus()
               self.editor = stxt(self.notebook, -1)
               self.editor.LoadFile(self.GetItemText(item))# here the
line that not read
               self.notebook.AddPage(self.editor, "File
%d"%self.count)

If you get an error it is good to post the actual error message.

Did you check what the value of GetItemText is returning? What exactly is 'stxt'?

Cody

If you get an error it is good to post the actual error message.

Did you check what the value of GetItemText is returning? What exactly
is 'stxt'?

here the error

Traceback (most recent call last):
  File "C:\Users\oscar\Desktop\myDYD\wxpyide\sourc\Explorer.py", line
44, in OnItemActivated
    self.editor.LoadFile(self.GetItemText(item))
TypeError: LoadFile() takes exactly 1 argument (2 given)

and the stxt is one file where i got the class for the
wx.stc.StyledTextCtrl

import StyledText as stxt

If you get an error it is good to post the actual error message.

Did you check what the value of GetItemText is returning? What exactly
is 'stxt'?

here the error

Traceback (most recent call last):
File "C:\Users\oscar\Desktop\myDYD\wxpyide\sourc\Explorer.py", line
44, in OnItemActivated
self.editor.LoadFile(self.GetItemText(item))
TypeError: LoadFile() takes exactly 1 argument (2 given)

and the stxt is one file where i got the class for the
wx.stc.StyledTextCtrl

import StyledText as stxt

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

Hi,
it seems, you may need to check the objects and methods you are
actually importing and using,
Would it be possible, that you are replacing/shadowing LoadFile method
somewhere in your code?
cf:
my_stc_editor = wx.stc.StyledTextCtrl( ... )

help(my_stc_editor.LoadFile)

Help on method LoadFile in module wx.stc:

LoadFile(*args, **kwargs) method of wx.stc.StyledTextCtrl instance
    LoadFile(self, String filename) -> bool

    Load the contents of filename into the editor

Moreover, the error messages for stc looks a bit different:

my_stc_editor.LoadFile("my_text_file.txt", 78)

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "wx\stc.pyc", line 5036, in LoadFile
TypeError: StyledTextCtrl_LoadFile() takes at most 2 arguments (3 given)

my_stc_editor.LoadFile()

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "wx\stc.pyc", line 5036, in LoadFile
TypeError: Required argument 'filename' (pos 2) not found

hth,
  vbr

···

2010/2/28 iozk_Live <iozk117@gmail.com>:

well
you not understand if don't you see it

i've upload the files for do you can help me

here http://www.megaupload.com/?d=2HOY095U

Hi,

well
you not understand if don't you see it

i've upload the files for do you can help me

here http://www.megaupload.com/?d=2HOY095U

Its exactly as you were already told, you are overriding LoadFile in
your subclass of StyledTextCtrl and you changed how many arguments it
has. (mystyle.StyledText).

    def LoadFile(self):
        self.GetText()

When you get problems like this it is always best to first write and
try to reproduce it in a small minimal sample.

Cody

···

On Mon, Mar 1, 2010 at 1:57 PM, iozk_Live <iozk117@gmail.com> wrote:

and how i can make one instance of the notebook inside of the class
treeExplorer for open the file in the notebook without appear above
the treeExplorer instead of that. in the notebook

import wx
from mystyle import StyleEditor as stxt
import Notebook as nb

class Explorer(wx.TreeCtrl):
    def __init__(self, parent, id):
        wx.TreeCtrl.__init__(self, parent, id, size=(250, 350))

        self.projectdirty = False

        self.Bind(wx.EVT_TREE_BEGIN_LABEL_EDIT, self.OnLabelEdit)
        self.Bind(wx.EVT_TREE_END_LABEL_EDIT, self.OnLabelEdit)
        self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnItemActivated)

    def OnLabelEdit(self, event):
        item = event.GetItem()
        if item != self.root:
            event.Veto()

    def OnLabelEditEnd(self, event):
        self.projectdirty = True

    def OnItemActivated(self, event, item=None):
        if event:
            item = event.GetItem()
            self.activeitem = item
            if item != self.root:
                #editor = stxt(self.notebook, -1)

                #self.notebook.AddPage(win, "File %d" %self.count)

                self.editor = stxt(nb, -1)
                self.editor.LoadFile(self.GetItemText(item))
                nb.Notebook.AddPage(self.editor, "File")

            else:
                StyleEditor.Clear()
                StyleEditor.Enable = False

Sorry, but we seem to be having a language problem here as I can not parse the above. Please make a small runnable sample that demonstrates the problem. MakingSampleApps - wxPyWiki

···

On 3/5/10 6:32 PM, iozk_Live wrote:

and how i can make one instance of the notebook inside of the class
treeExplorer for open the file in the notebook without appear above
the treeExplorer instead of that. in the notebook

--
Robin Dunn
Software Craftsman