I try to work with ScrolledPanel but it doesn't run. So I created a
simplified code to demonstrate it. Of course I looked at the demo.py.
Looks nice and work. But I am not able to adapt the code from there.
When I run the code I get (with wxPhoenix and Py3) some gtk-errors.
[err]
(process:15066): GLib-GObject-WARNING **: invalid (NULL) pointer
instance
(process:15066): GLib-GObject-CRITICAL **: g_signal_connect_data:
assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
(process:15066): Gdk-CRITICAL **: IA__gdk_screen_get_default_colormap:
assertion 'GDK_IS_SCREEN (screen)' failed
(process:15066): Gdk-CRITICAL **: IA__gdk_colormap_get_visual:
assertion 'GDK_IS_COLORMAP (colormap)' failed
(process:15066): Gdk-CRITICAL **: IA__gdk_screen_get_default_colormap:
assertion 'GDK_IS_SCREEN (screen)' failed
(process:15066): Gdk-CRITICAL **: IA__gdk_screen_get_root_window:
assertion 'GDK_IS_SCREEN (screen)' failed
(process:15066): Gdk-CRITICAL **: IA__gdk_screen_get_root_window:
assertion 'GDK_IS_SCREEN (screen)' failed
(process:15066): Gdk-CRITICAL **: IA__gdk_window_new: assertion
'GDK_IS_WINDOW (parent)' failed Speicherzugriffsfehler (Speicherabzug
geschrieben)
[/err]
That is the code
[code]
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import wx
import wx.lib.scrolledpanel
class MyCtrl(wx.Panel):
def __init__(self, parent):
super(MyCtrl, self).__init__(parent)
sz = wx.BoxSizer(wx.HORIZONTAL)
sz.Add(wx.TextCtrl(self))
sz.Add(wx.TextCtrl(self))
self.SetSizer(sz)
class MyDialog(wx.Dialog):
def __init__(self, parent):
super(MyDialog, self).__init__(parent,
style=wx.RESIZE_BORDER|wx.DEFAULT_DIALOG_STYLE) sz =
wx.BoxSizer(wx.VERTICAL) sz.Add(wx.StaticText(self, label='Text'))
p = wx.lib.scrolledpanel.ScrolledPanel(self)
ps = wx.BoxSizer(wx.VERTICAL)
ps.Add(MyCtrl(p))
ps.Add(MyCtrl(p))
p.SetSizer(ps)
sz.Add(p)
sz.Add(wx.StaticText(self, label='Text'))
self.SetSizer(sz)
if __name__ == '__main__':
with MyDialog(None) as dlg:
dlg.ShowModal()
app.MainLoop()
[/code]