[wxPython] HTML wont work, Questions to Splitter

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[wxPython] HTML wont work, Questions to Splitter

Schaeffler
Hi,

i have some questions:

HTML:
I 've installed wxPython form scratch for linux and irix - it's fine
exept that the HTML things wont
work. My Installation:
  Python-1.5.2
  glib-1.2.3
  gtk+-1.2.3/
  wxGTK-2.1.11/
  wxPython-2.1.11
The wxGTK HTML  samples are ok, no


Splitter:
I'd try to use wxSplitter with a Grid, maybe somebody could thell me why
the size of the Grid is not ok (i had
the same problem with Panel). More at line 40
wx_gsr_grid.py/wx_gsr_grid_splitter.py

thanks,

--
Harald Schäffler

80788 Muenchen, Germany

Phone  +49 89 38243531
Fax    +49 89 38247140
Email: [hidden email]



from wxPython.wx          import *
from wxPython.lib.layoutf import Layoutf


#---------------------------------------------------------------------------
#---------------------------------------------------------------------------
class gsrGrid(wxGrid):
    def __init__(self, parent):
        # as a parameter,
        wxGrid.__init__(self, parent, -1)

        self.CreateGrid(16, 16)
        self.SetEditable(false)
        self.SetEditInPlace(false)
        self.SetColumnWidth(3, 200)
        self.SetRowHeight(4, 45)
        self.SetCellValue("First cell", 0, 0)
        self.SetCellValue("Another cell", 1, 1)
        self.SetCellValue("Yet another cell", 2, 2)
        self.SetCellTextFont(wxFont(12, wxROMAN, wxITALIC, wxNORMAL), 0, 0)
        self.SetCellTextColour(wxRED, 1, 1)
        self.SetCellBackgroundColour(wxCYAN, 2, 2)
        self.UpdateDimensions()
        self.AdjustScrollbars()


#---------------------------------------------------------------------------

class gsrFrame(wxFrame):
    def __init__(self, parent, id, title):
        wxFrame.__init__(self, parent, -1, title, size = (600, 400))

        if wxPlatform == '__WXMSW__':
            self.icon = wxIcon('bitmaps/mondrian.ico', wxBITMAP_TYPE_ICO)
            self.SetIcon(self.icon)
       
        self.CreateStatusBar(1)
        self.Show(true)
       
        gsrGrid(self) #  looks fine
       
#         splitter = wxSplitterWindow(self, -1)
#         p1 = wxWindow(splitter, -1)
#         p1.SetBackgroundColour(wxWHITE)
#         p2 = wxWindow(splitter, -1)
#         splitter.SetMinimumPaneSize(20)
#         splitter.SplitHorizontally(p1, p2)
#         splitter.SetSashPosition(100)
#    
#
# gsrGrid(p2) # whats that ????
       

class MyApp(wxApp):
    def OnInit(self):
        frame = gsrFrame(NULL, -1, "gsr")
        frame.Show(true)
        self.SetTopWindow(frame)
        return true

#---------------------------------------------------------------------------

app = MyApp(0)
app.MainLoop()


from wxPython.wx          import *
from wxPython.lib.layoutf import Layoutf


#---------------------------------------------------------------------------
#---------------------------------------------------------------------------
class gsrGrid(wxGrid):
    def __init__(self, parent):
        # as a parameter,
        wxGrid.__init__(self, parent, -1)

        self.CreateGrid(16, 16)
        self.SetEditable(false)
        self.SetEditInPlace(false)
        self.SetColumnWidth(3, 200)
        self.SetRowHeight(4, 45)
        self.SetCellValue("First cell", 0, 0)
        self.SetCellValue("Another cell", 1, 1)
        self.SetCellValue("Yet another cell", 2, 2)
        self.SetCellTextFont(wxFont(12, wxROMAN, wxITALIC, wxNORMAL), 0, 0)
        self.SetCellTextColour(wxRED, 1, 1)
        self.SetCellBackgroundColour(wxCYAN, 2, 2)
        self.UpdateDimensions()
        self.AdjustScrollbars()


#---------------------------------------------------------------------------

class gsrFrame(wxFrame):
    def __init__(self, parent, id, title):
        wxFrame.__init__(self, parent, -1, title, size = (600, 400))

        if wxPlatform == '__WXMSW__':
            self.icon = wxIcon('bitmaps/mondrian.ico', wxBITMAP_TYPE_ICO)
            self.SetIcon(self.icon)
       
        self.CreateStatusBar(1)
        self.Show(true)
       
# gsrGrid(self) #  looks fine
       
        splitter = wxSplitterWindow(self, -1)
        p1 = wxWindow(splitter, -1)
        p1.SetBackgroundColour(wxWHITE)
        p2 = wxWindow(splitter, -1)
        splitter.SetMinimumPaneSize(20)
        splitter.SplitHorizontally(p1, p2)
        splitter.SetSashPosition(100)
   
       
        gsrGrid(p2) # whats that ????
       

class MyApp(wxApp):
    def OnInit(self):
        frame = gsrFrame(NULL, -1, "gsr")
        frame.Show(true)
        self.SetTopWindow(frame)
        return true

#---------------------------------------------------------------------------

app = MyApp(0)
app.MainLoop()

Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] HTML wont work, Questions to Splitter

Robin Dunn
> HTML:
> I 've installed wxPython form scratch for linux and irix - it's fine
> exept that the HTML things wont
> work. My Installation:
>   Python-1.5.2
>   glib-1.2.3
>   gtk+-1.2.3/
>   wxGTK-2.1.11/
>   wxPython-2.1.11
> The wxGTK HTML  samples are ok, no

In what way don't they work?  Did you build the html module?  (Go into
wxPython/modules/html and build.)


> Splitter:
> I'd try to use wxSplitter with a Grid, maybe somebody could thell me why
> the size of the Grid is not ok (i had
> the same problem with Panel). More at line 40
> wx_gsr_grid.py/wx_gsr_grid_splitter.py

>         splitter = wxSplitterWindow(self, -1)
>         p1 = wxWindow(splitter, -1)
>         p1.SetBackgroundColour(wxWHITE)
>         p2 = wxWindow(splitter, -1)
>         splitter.SetMinimumPaneSize(20)
>         splitter.SplitHorizontally(p1, p2)
>         splitter.SetSashPosition(100)
>         gsrGrid(p2)
>

The splitter sizes it's immediate children to take up the available space in
each pane, but doesn't do anything with any grandchild windows.  You have
wxSplitterWindow --> wxWindow --> gsrGrid, so the wxWindow is responsible for
sizing the gsrGrid.  So if you really want a wxWindow there you need to
create a derived class with an OnSize that will size the grid.  The other
alternative is to just do wxSplitterWindow --> gsrGrid, like this:

         splitter = wxSplitterWindow(self, -1)
         p1 = wxWindow(splitter, -1)
         p1.SetBackgroundColour(wxWHITE)
         p2 = gsrGrid(splitter)
         splitter.SetMinimumPaneSize(20)
         splitter.SplitHorizontally(p1, p2)
         splitter.SetSashPosition(100)

This way the splitter will be managing the size of the grid like you want.

--
Robin Dunn
Software Craftsman
[hidden email]
http://AllDunn.com/robin/
http://AllDunn.com/wxPython/  Check it out!



_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users