Make wxListCtrl fit around contents and parent frame fit around listctrl

Discussion in 'Python' started by Piet, Jul 18, 2004.

  1. Piet

    Piet Guest

    Hello,
    I am working on a graphical MySQL Frontend written in python/wxPython.
    The results from a table query are displayed either in a wxGrid or in
    a wxListCtrl. I would prefer the latter because it underlines the
    read-only character of the data, but I am not happy with the way the
    results are displayed.
    The wxGrid with the results is laid out by the following code:
    resultsFrame = wxFrame(parent,-1,title)
    resultsTable = wxGrid(resultsFrame,-1)
    #populate grid with results...
    resultsTable.Fit()
    sizer = wxBoxSizer(wxVERTICAL)
    sizer.Add(resultsTable,1,wxEXPAND)
    resultsFrame.SetSizer(sizer)
    resultsFrame.SetAutoLayout(True)
    sizer.Fit(resultsFrame)
    resultsFrame.Show(True)
    This ensures that each column of the grid is adjusted to fit the
    longest cell and that the wxFrame fits around the grid. However, I
    have not found a way to achieve the same results for a wxListCtrl
    despite trying several combinations of .Fit()-functions. For example,
    the following code
    resultsFrame = wxFrame(parent,-1,title)
    resultsList = wxListCtrl(resultsFrame,-1,style =
    wxLC_REPORT|wxLC_VRULES|wxLC_HRULES)
    #populate wxListCtrl
    resultsList.Fit()
    resultsList.EnsureVisible(True)
    resultsList.SetColumnWidth(-1,-1)
    sizer = wxBoxSizer(wxVERTICAL)
    sizer.Add(resultsList,1,wxEXPAND)
    resultsFrame.SetSizer(sizer)
    resultsFrame.SetAutoLayout(True)
    sizer.Fit(resultsFrame)
    resultsFrame.Fit()
    resultsFrame.Show(True)
    always generates a Frame of the same size, regardless of the length
    and width of the listctrl. I have checked the wxListCtrl
    documentation, but I couldn't find the information I was looking for.
    Does anyboy know how to format a wxListCtrl that displays all of its
    information without scrolling and/or resizing columns?
    THanks in advance
    Piet
     
    Piet, Jul 18, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Joost van Rooij

    Delete item from wxListCtrl

    Joost van Rooij, Jul 4, 2003, in forum: Python
    Replies:
    1
    Views:
    652
    Joost van Rooij
    Jul 7, 2003
  2. Mark Carter
    Replies:
    1
    Views:
    533
    Steve Zatz
    Dec 1, 2003
  3. =?iso-8859-1?B?aWFuYXLp?=

    suse linux 10 and wx.listctrl display issues

    =?iso-8859-1?B?aWFuYXLp?=, Mar 8, 2006, in forum: Python
    Replies:
    3
    Views:
    385
    =?iso-8859-1?B?aWFuYXLp?=
    Mar 13, 2006
  4. Stuart Wexler

    Preselecting from parent frame to child frame

    Stuart Wexler, Apr 23, 2004, in forum: Javascript
    Replies:
    1
    Views:
    126
    Mick White
    Apr 23, 2004
  5. Aaron C
    Replies:
    2
    Views:
    199
    Dr J R Stockton
    Nov 21, 2009
Loading...

Share This Page