View XHTML in wxPython

Hi all.
I’ve a XML to represent in wxpython
If I tranform the XML to XHTML with XSLT, how can i view XHTML in a wxPython view?
Is it possible?
Thanks all.

···


Sbaush

Hi all another time!
I read in www that exist wxHTML. Do you know it?
Is there a documentation of it?
Is a good way in your opinion?

···

2006/1/27, Sbaush < sbaush@gmail.com>:

Hi all.
I’ve a XML to represent in wxpython
If I tranform the XML to XHTML with XSLT, how can i view XHTML in a wxPython view?

Is it possible?
Thanks all.

Sbaush


Sbaush

Sbaush wrote:

Hi all another time!
I read in www that exist wxHTML. Do you know it?
Is there a documentation of it?

Yes, look up wxHtmlWindow in the C++ reference docs.

Is a good way in your opinion?

It supports only a subset of the HTML 4.0 standard, so it may not be able to do all you need it to. An alternative is to embed an internet explorer window in your app, if you are running on Windows. See the demo.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

ok, understand…
Luclky i’m a Linux user but can’t use the simpleIEBrowser of pythoncard examples.

···

2006/1/28, Robin Dunn <robin@alldunn.com >:

Sbaush wrote:

Hi all another time!
I read in www that exist wxHTML. Do you know it?

Is there a documentation of it?

Yes, look up wxHtmlWindow in the C++ reference docs.

Is a good way in your opinion?

It supports only a subset of the HTML 4.0 standard, so it may not be

able to do all you need it to. An alternative is to embed an internet
explorer window in your app, if you are running on Windows. See the demo.


Robin Dunn
Software Craftsman

http://wxPython.org
Java give you jitters? Relax with wxPython!


To unsubscribe, e-mail:
wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org


Sbaush

Hey All,

I have an application that I am building that will create a configuration file (XML) for a presentation I have built. The left side contains a wx.TreeCtrl that contains a hierarchy similar to:

Section Name
    Challenge
    Solution
    Success
    Files

Section Name
    Challenge
    Solution
    Success
    Files

On the right there is a wx.NoteBook that will display the requisite forms. I have essentially 3 sets of multi-tab forms that I need to be able to swap in and out depending on why type of option the user is configuring. Ideally, I would like to create instances of a class and show and hide them, however, that does not seem to be possible. So, I thought I would configure the notebook depending on which option is selected.

Anyhow, when the user clicks on the Section Name the notebook on the right should show one tab [section details], when the user selects Challenge, Solution, Success the notebook will show [Content][Supplement] tabbed panels, and when the user selects files, the notebook should contain [Files] tab.
   
Currently, the code looks something like:

import wx

# begin wxGlade: dependencies
from Content_Panel import Content_Panel
from Supplemental_Panel import Supplemental_Panel
from File_Panel import File_Panel
from Welcome_Panel import Welcome_Panel
# end wxGlade

class Detail_Panel(wx.Notebook):
    def __init__(self, *args, **kwds):
        # begin wxGlade: Detail_Panel.__init__
        kwds["style"] = 0
        wx.Notebook.__init__(self, *args, **kwds)

        self.__set_properties()
        self.__do_layout()
        # end wxGlade

    def __set_properties(self):
        self.change_panels(0, '', '')
        pass
        # end wxGlade

    def __do_layout(self):
        # begin wxGlade: Detail_Panel.__do_layout
        pass
        # end wxGlade

    def txt_option(self, event): # wxGlade: Detail_Panel.<event_handler>
        print "Event handler `txt_option' not implemented!"
        event.Skip()
       def change_panels(self, new_panel, current, new):
        if new_panel == 0:
            self.current_panel = 0
            self.save_data(current) # Save existing data from fields
            self.clear_notebook() # Remove the notebook panels
            self.welcome = Welcome_Panel(self, -1)
            self.AddPage(self.welcome, "Welcome")
            self.load_data(new) # Load any existing data from object to fields
        elif new_panel == 2:
            self.current_panel = 2
            self.save_data(current)
            self.clear_notebook()
            self.nbp_content = Content_Panel(self, -1)
            self.nbp_supplemental = Supplemental_Panel(self, -1)
            self.AddPage(self.nbp_content, "Content")
            self.AddPage(self.nbp_supplemental, "Supplemental Info")
            self.load_data(new)
        elif new_panel == 3:
            self.current_panel = 3
            self.save_data(current)
            self.clear_notebook()
            self.files = File_Panel(self, -1)
            self.AddPage(self.files, 'Files')
            self.load_data(new)
               num = self.GetPageCount()
        print num
       def clear_notebook(self):
        num = self.GetPageCount()
        c = 0
        while c < num:
            self.RemovePage(c)
            c += 1
        return
       def save_data(self, obj):
        pass
       def load_data(self, obj):
        pass

And it works... mostly. However, it is really ugly. All sorts of flashing and stuff in the interface... and sometimes, it doesn't display all the necessary tabs. I'm still getting my arms around python and wxPython (and am a new "programmer") so I'm sure my approach is sloppy(and poorly conceived) as well.

Any suggestions would be very helpful.

Thanks,

Matt

I've changed:
     def clear_notebook(self):
       num = self.GetPageCount()
       c = 0
       while c < num:
           self.RemovePage(c)
           c += 1
       return
to:
     def clear_notebook(self):
        self.DeleteAllPages()
        return

...which has solved the inconsistency. But I still get a horrible flashing (on Windows XP).

I saw some mention of a refresh problem in the source of the demo and tried adding a panel, then adding the tabs to that, but it kept erroring out saying that the notebook panels had to have a notebook as a parent.

Matt

Matthew Korsmo wrote:

···

Hey All,

I have an application that I am building that will create a configuration file (XML) for a presentation I have built. The left side contains a wx.TreeCtrl that contains a hierarchy similar to:

Section Name
   Challenge
   Solution
   Success
   Files

Section Name
   Challenge
   Solution
   Success
   Files

On the right there is a wx.NoteBook that will display the requisite forms. I have essentially 3 sets of multi-tab forms that I need to be able to swap in and out depending on why type of option the user is configuring. Ideally, I would like to create instances of a class and show and hide them, however, that does not seem to be possible. So, I thought I would configure the notebook depending on which option is selected.

Anyhow, when the user clicks on the Section Name the notebook on the right should show one tab [section details], when the user selects Challenge, Solution, Success the notebook will show [Content][Supplement] tabbed panels, and when the user selects files, the notebook should contain [Files] tab.
Currently, the code looks something like:

import wx

# begin wxGlade: dependencies
from Content_Panel import Content_Panel
from Supplemental_Panel import Supplemental_Panel
from File_Panel import File_Panel
from Welcome_Panel import Welcome_Panel
# end wxGlade

class Detail_Panel(wx.Notebook):
   def __init__(self, *args, **kwds):
       # begin wxGlade: Detail_Panel.__init__
       kwds["style"] = 0
       wx.Notebook.__init__(self, *args, **kwds)

       self.__set_properties()
       self.__do_layout()
       # end wxGlade

   def __set_properties(self):
       self.change_panels(0, '', '')
       pass
       # end wxGlade

   def __do_layout(self):
       # begin wxGlade: Detail_Panel.__do_layout
       pass
       # end wxGlade

   def txt_option(self, event): # wxGlade: Detail_Panel.<event_handler>
       print "Event handler `txt_option' not implemented!"
       event.Skip()
     def change_panels(self, new_panel, current, new):
       if new_panel == 0:
           self.current_panel = 0
           self.save_data(current) # Save existing data from fields
           self.clear_notebook() # Remove the notebook panels
           self.welcome = Welcome_Panel(self, -1)
           self.AddPage(self.welcome, "Welcome")
           self.load_data(new) # Load any existing data from object to fields
       elif new_panel == 2:
           self.current_panel = 2
           self.save_data(current)
           self.clear_notebook()
           self.nbp_content = Content_Panel(self, -1)
           self.nbp_supplemental = Supplemental_Panel(self, -1)
           self.AddPage(self.nbp_content, "Content")
           self.AddPage(self.nbp_supplemental, "Supplemental Info")
           self.load_data(new)
       elif new_panel == 3:
           self.current_panel = 3
           self.save_data(current)
           self.clear_notebook()
           self.files = File_Panel(self, -1)
           self.AddPage(self.files, 'Files')
           self.load_data(new)
             num = self.GetPageCount()
       print num
     def clear_notebook(self):
       num = self.GetPageCount()
       c = 0
       while c < num:
           self.RemovePage(c)
           c += 1
       return
     def save_data(self, obj):
       pass
     def load_data(self, obj):
       pass

And it works... mostly. However, it is really ugly. All sorts of flashing and stuff in the interface... and sometimes, it doesn't display all the necessary tabs. I'm still getting my arms around python and wxPython (and am a new "programmer") so I'm sure my approach is sloppy(and poorly conceived) as well.

Any suggestions would be very helpful.

Thanks,

Matt

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Hi,

This is probably a simple question, but 20 minutes on the information super
highway has not yielded me an answer. I am trying to handle a WX_EVT_CHAR
event with a wx.Dialog as follows:

class PlotDialog(wx.Dialog):
    def __init__(<etc...>)

        <etc...>
        self.Bind(wx.EVT_CHAR, self.onCharEvent)
        <etc...>

    def onCharEvent(self, evt):
        print "Inside onEvtChar"
        if event.GetKeyCode() == CTRL_C_KEYCODE: #defined elsewhere as 3
            self.canvas.Copy_to_Clipboard(event=evt)
            print "Copied Figure"
        else:
            evt.Skip()

For some reason, the key event is never trapped. Neither of the print
statements in the handler execute ever. After looking at examples on-line
I see that most EVT_CHARs are associated with text controls. Is there a
subset of controls that are eligible to process an EVT_CHAR? The dialog
contains only three controls: a matplotlip canvas, a button, and a
matplotlob NavigationToolBar. I tried associating the EVT_CHAR with the
canvas:

self.Bind(wx.EVT_CHAR, self.onCharEvent, self.canvas)

but this didn't help. Any ideas?

Thanks,
-mike

IIRC, Freeze() and Thaw() were suggested sometimes as a solution if
flickering occurs. Maybe you can find something in the archive.

Harald Stürzebecher

···

2006/1/29, Matthew Korsmo <matthew@departurempls.com>:

...which has solved the inconsistency. But I still get a horrible
flashing (on Windows XP).

Matthew Korsmo wrote:

I've changed:
    def clear_notebook(self):
      num = self.GetPageCount()
      c = 0
      while c < num:
          self.RemovePage(c)
          c += 1
      return
to:
    def clear_notebook(self):
       self.DeleteAllPages()
       return

...which has solved the inconsistency. But I still get a horrible flashing (on Windows XP).

I saw some mention of a refresh problem in the source of the demo and tried adding a panel, then adding the tabs to that, but it kept erroring out saying that the notebook panels had to have a notebook as a parent.

Please create a small, but complete sample app that shows what you are trying to do and the problems you are having. That way we can better understand your needs.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Michael Nathaniel Cantor wrote:

Hi,

This is probably a simple question, but 20 minutes on the information super
highway has not yielded me an answer. I am trying to handle a WX_EVT_CHAR
event with a wx.Dialog as follows:

class PlotDialog(wx.Dialog):
    def __init__(<etc...>)

        <etc...>
        self.Bind(wx.EVT_CHAR, self.onCharEvent)
        <etc...>

    def onCharEvent(self, evt):
        print "Inside onEvtChar"
        if event.GetKeyCode() == CTRL_C_KEYCODE: #defined elsewhere as 3
            self.canvas.Copy_to_Clipboard(event=evt)
            print "Copied Figure"
        else:
            evt.Skip()

For some reason, the key event is never trapped. Neither of the print
statements in the handler execute ever. After looking at examples on-line
I see that most EVT_CHARs are associated with text controls. Is there a
subset of controls that are eligible to process an EVT_CHAR?

The key point to understand is that EVT_CHAR and EVT_KEY_* events are only sent to the window that currently has the focus, and since they are not derived from wx.CommandEvent the events do not travel up the containment heirarchy. Any window or widget type that can have the focus can receive EVT_CHAR or EVT_KEY_* events, but normally a dialog will never have the focus because as soon as it gets the focus, it will try to give it to one of its child widgets.

For simple "hotkey" type key binding you might try assigning an accelerator table to the dialog.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Thanks again, Robin, for the helpful explanation. The accelerator table solution worked fine.

-mike

···

At 08:00 PM 1/29/2006, you wrote:

Michael Nathaniel Cantor wrote:

Hi,
This is probably a simple question, but 20 minutes on the information super
highway has not yielded me an answer. I am trying to handle a WX_EVT_CHAR
event with a wx.Dialog as follows:
class PlotDialog(wx.Dialog):
    def __init__(<etc...>)
        <etc...>
        self.Bind(wx.EVT_CHAR, self.onCharEvent)
        <etc...>
    def onCharEvent(self, evt):
        print "Inside onEvtChar"
        if event.GetKeyCode() == CTRL_C_KEYCODE: #defined elsewhere as 3
            self.canvas.Copy_to_Clipboard(event=evt)
            print "Copied Figure"
        else:
            evt.Skip()
For some reason, the key event is never trapped. Neither of the print
statements in the handler execute ever. After looking at examples on-line
I see that most EVT_CHARs are associated with text controls. Is there a
subset of controls that are eligible to process an EVT_CHAR?

The key point to understand is that EVT_CHAR and EVT_KEY_* events are only sent to the window that currently has the focus, and since they are not derived from wx.CommandEvent the events do not travel up the containment heirarchy. Any window or widget type that can have the focus can receive EVT_CHAR or EVT_KEY_* events, but normally a dialog will never have the focus because as soon as it gets the focus, it will try to give it to one of its child widgets.

For simple "hotkey" type key binding you might try assigning an accelerator table to the dialog.

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org