Any suggestion/example how to tear off a notebook tab.
The idea is that the contents of the tab is moved into
a separate window.
The tab is removed from the notebook. However, the data
associated with the tab should *not* be deleted since
that is now owned by the window.
Is soemthing special which needs to be done when the tab
is created? For example, put a panel inside the tab.
It will be hard in 2.4 without the notebook HitTest method, but assuming that you are able to tell which tab to tear off, and that you have sensed the drag operation and are ready to do it:
* Use RemovePage to remove the tab without deleting the page window.
* Use thePageWindow.Reparent(newParent) to make the page window be a child of some other window.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
Thank you for your very quick response! I will try that.
The missing HitTest() is not a concern since the currently
selected tab will be torn off.
/Jean Brouwers
Robin Dunn wrote:
···
Jean Brouwers wrote:
Any suggestion/example how to tear off a notebook tab.
The idea is that the contents of the tab is moved into
a separate window.
The tab is removed from the notebook. However, the data
associated with the tab should *not* be deleted since
that is now owned by the window.
Is soemthing special which needs to be done when the tab
is created? For example, put a panel inside the tab.
It will be hard in 2.4 without the notebook HitTest method, but assuming that you are able to tell which tab to tear off, and that you have sensed the drag operation and are ready to do it:
* Use RemovePage to remove the tab without deleting the page window.
* Use thePageWindow.Reparent(newParent) to make the page window be a child of some other window.
The good news is that tearing off a notebook tab is working.
The bad news is that there are two, nasty messages from GTK:
(uiMain.py:9114): GLib-GObject-WARNING **: invalid cast from (NULL) pointer to `GtkContainer'
(uiMain.py:9114): Gtk-CRITICAL **: file gtkcontainer.c: line 878 (gtk_container_remove): assertion `GTK_IS_CONTAINER (container)' faild
Both messages show up after the p.Reparent() and before the
f.Show() call in this code fragment:
p = nb.GetPage(i)
f = wx.Frame(None, -1, title='...', size=p.GetSize())
b = nb.RemovePage(i)
nb.Refresh()
p.Reparent(f)
f.Show()
What I need to change to avoid these messages? Also,
what does the bool result of RemovePage() mean and is
there anything I need to with that?
/Jean Brouwers
PS) This is on wxPython2.4.1.2/Python2.3.1 on RH8/GTK2.
PPS) The Reparent() call is on line 280. There is no
line 9114, the entire uiMain.py module has 728 lines.
I noticed the same problem in other GTK message and it
makes debugging wxPython code very tedious.
Robin Dunn wrote:
···
Jean Brouwers wrote:
Any suggestion/example how to tear off a notebook tab.
The idea is that the contents of the tab is moved into
a separate window.
The tab is removed from the notebook. However, the data
associated with the tab should *not* be deleted since
that is now owned by the window.
Is soemthing special which needs to be done when the tab
is created? For example, put a panel inside the tab.
It will be hard in 2.4 without the notebook HitTest method, but assuming that you are able to tell which tab to tear off, and that you have sensed the drag operation and are ready to do it:
* Use RemovePage to remove the tab without deleting the page window.
* Use thePageWindow.Reparent(newParent) to make the page window be a child of some other window.
I'm using a wxGrid with custom data results in a grid of limited size.
My first question is, how can I fit the window/frame size to fir around
the grid?
The second question is how can I make the grid look 'endless' after the
window/frame has been resized? Either by adding more rows and columns
or by stretching the right/bottom cells?
I need to show a log file in a frame and be able to scroll
(and eventually search) through that log file. The main issue
is that the log file can be very large, up to several hundred
MB.
The question is what is the best approach in wxPython, given
that it is infeasible to load the entire log file into memory?
My initial thoughts are to use the wxListCtrl* with the virtual
report style and the linecache module. Another option might
be the wxStyledTextCtrl.
Any suggestions?
/Jean Brouwers
*) The wxListCtrl has a method GetTopItem() to find the top-
most visible item? How can I find the "BottomItem" or the
number of lines shown in the frame?
The good news is that tearing off a notebook tab is working.
The bad news is that there are two, nasty messages from GTK:
(uiMain.py:9114): GLib-GObject-WARNING **: invalid cast from (NULL) pointer to `GtkContainer'
(uiMain.py:9114): Gtk-CRITICAL **: file gtkcontainer.c: line 878 (gtk_container_remove): assertion `GTK_IS_CONTAINER (container)' faild
Both messages show up after the p.Reparent() and before the
f.Show() call in this code fragment:
p = nb.GetPage(i)
f = wx.Frame(None, -1, title='...', size=p.GetSize())
b = nb.RemovePage(i)
nb.Refresh()
p.Reparent(f)
f.Show()
What I need to change to avoid these messages?
It's hard to say. Perhaps you can experiment with doing things in
different order and such.
Also,
what does the bool result of RemovePage() mean and is
there anything I need to with that?
It just specifies if the remove was successful.
/Jean Brouwers
PS) This is on wxPython2.4.1.2/Python2.3.1 on RH8/GTK2.
PPS) The Reparent() call is on line 280. There is no
line 9114, the entire uiMain.py module has 728 lines.
I noticed the same problem in other GTK message and it
makes debugging wxPython code very tedious.
It's not a line number, but the process ID or something like that. The
messages are coning from deep in the GTK C code and don't know anything
about the line numbers in your Python code.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
I'm using a wxGrid with custom data results in a grid of limited size.
My first question is, how can I fit the window/frame size to fir around
the grid?
Calculate the size required for the grid and size the frame to match.
The second question is how can I make the grid look 'endless' after the
window/frame has been resized? Either by adding more rows and columns
or by stretching the right/bottom cells?
Catch the EVT_SIZE of the frame and then resize the grid to match and
then do whatever you want to the grid to adjust its appearance. Or you
could just add the extra rows/cols to the grid at the begining and use
the scrollbars when the window is smaller.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
I need to show a log file in a frame and be able to scroll
(and eventually search) through that log file. The main issue
is that the log file can be very large, up to several hundred
MB.
The question is what is the best approach in wxPython, given
that it is infeasible to load the entire log file into memory?
My initial thoughts are to use the wxListCtrl* with the virtual
report style and the linecache module.
Sounds good to me.
Another option might
be the wxStyledTextCtrl.
It would also want to load the whoel file into memory.
Any suggestions?
/Jean Brouwers
*) The wxListCtrl has a method GetTopItem() to find the top-
most visible item? How can I find the "BottomItem" or the
number of lines shown in the frame?
GetCountPerPage()
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
b = nb.RemovePage(i)
p.Reparent(f)
nb.Refresh()
f.Show()
2) and this shows 6 different GTK messages and Abort(core dump):
p.Reparent(f)
b = nb.RemovePage(i)
nb.Refresh()
f.Show()
There are no other orders I can think of.
/Jean Brouwers
Robin Dunn wrote:
···
Jean Brouwers wrote:
Robin,
The good news is that tearing off a notebook tab is working.
The bad news is that there are two, nasty messages from GTK:
(uiMain.py:9114): GLib-GObject-WARNING **: invalid cast from (NULL) pointer to `GtkContainer'
(uiMain.py:9114): Gtk-CRITICAL **: file gtkcontainer.c: line 878 (gtk_container_remove): assertion `GTK_IS_CONTAINER (container)' faild
Both messages show up after the p.Reparent() and before the
f.Show() call in this code fragment:
p = nb.GetPage(i)
f = wx.Frame(None, -1, title='...', size=p.GetSize())
b = nb.RemovePage(i)
nb.Refresh()
p.Reparent(f)
f.Show()
What I need to change to avoid these messages?
It's hard to say. Perhaps you can experiment with doing things in
different order and such.
Also,
what does the bool result of RemovePage() mean and is
there anything I need to with that?
It just specifies if the remove was successful.
/Jean Brouwers
PS) This is on wxPython2.4.1.2/Python2.3.1 on RH8/GTK2.
PPS) The Reparent() call is on line 280. There is no
line 9114, the entire uiMain.py module has 728 lines.
I noticed the same problem in other GTK message and it
makes debugging wxPython code very tedious.
It's not a line number, but the process ID or something like that. The
messages are coning from deep in the GTK C code and don't know anything
about the line numbers in your Python code.
b = nb.RemovePage(i)
p.Reparent(f)
nb.Refresh()
f.Show()
2) and this shows 6 different GTK messages and Abort(core dump):
p.Reparent(f)
b = nb.RemovePage(i)
nb.Refresh()
f.Show()
There are no other orders I can think of.
The only other suggestion then (other than just living with the warnings) is to dig into the wxGTK with a ddebugger and see exactly what's causing the messages, but that is not very fun.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
We're using a virtual wxGrid with a CustomDataTable. The size of the
grid changes over time, specifically the number of rows can grow or
shrink, periodically.
The contents of the existing rows is correctly updated. But any
additional rows do not show up in the grid on the screen.
What do we need to do to adjust the size of the grid such that it
correctly reflects the new row count?
/Jean Brouwers
PS) This is wxPython 2.4.1.2 and Python 2.3.1 on RH 8 Linux with GTK2.
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org
How can I prevent changes in the the col width or row height?
It seems that the EVT_GRID_COL/ROW_SIZE occurs *after* the
changes has been made already?
There are Set[Col|Row]MinimalWidth methods, but I don't see anything for the max or any other way to limit it. You could enter a feature request for it.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
Maybe there's a misunderstanding here. I was looking for a way
to avoid the height of a row from being changed (or the width
of a column).
Maybe an event called something like EVT_GRID_DRAG_BEGIN which
would be generated before a row or column line is dragged and
which could be veto'd.
There are examples of such events in other controls like in the
wxTreeCtrl the EVT_TREE_ITEM_EXPANDING and _EXPANDED and the
EVT_TREE_ITEM_COLLAPSING and _COLLAPSED.
Setting min/max row/column sizes would do the same, obviously,
but may not be a simple to use. An event allows other things
to be checked not just size.
/Jean Brouwers
PS) Same text has been filed as RFE 852379 'wxGrid row/col
size limits'
Robin Dunn wrote:
···
Jean Brouwers wrote:
How can I prevent changes in the the col width or row height?
It seems that the EVT_GRID_COL/ROW_SIZE occurs *after* the
changes has been made already?
There are Set[Col|Row]MinimalWidth methods, but I don't see anything for the max or any other way to limit it. You could enter a feature request for it.
We have been trying for several days now to get wxGrid to refresh
a table correctly after some rows have been added to a custom data
table using AppendRows().
Using ForceRefresh() simply does not fully refresh the grid. Nothing
seems to update the screen image completely, there are always blank
spots or even partial images of the grid on top of each other.
The grid is located inside a notebook tab and doing a Refresh() on
that tab does not help either.
The vertical scroll bar in the grid and tab disappears occasionally
and once that is gone, it never comes back. Even 'jiggling' the grid
size prior to refresh calls does not result in a proper screen update.
Finally, deleting all rows with DeleteRows() and then an AppendRows()
call with the new row count does not work.
It seems that there are two options left. (1) recreate the grid and
entire from scratch using the existing data table or (2) reset the
existing data table in the existing grid using SetTable().
We have not tried either of these and before we invest more effort
into this project, we were wondering whether there is anything else/
better we should try first.
The workaround we use for now is the make the grid much larget than
it needs to be to accomodate all future grows. While that seems to
work, it looks rather ugly and appears to be slower.
/Jean Brouwers
PS) This is wxPython 2.4.1.2 with Python 2.3.1 on RH 8 Linux with GTK2.
Robin Dunn wrote:
···
Jean Brouwers wrote:
The wxGrid has a SetColAttr() and SetRowAttr() method. But there
does not seem to be a GetColAttr() and GetRowAttr() method.
Is there a way to find which attr is set for a col/row? Other than
keeping track attr?