class wx.Frame: setfaults without size hints

When the main module is executed with this code:

class MainFrame(wx.Frame):

     def __init__(self, parent):
         wx.Frame.__init__(self, parent=None, id=wx.ID_ANY, title="openEDMS",
                           size=wx.Size(700,400), style=wx.DEFAULT_FRAME_STYLE|
                           wx.TAB_TRAVERSAL, name = "main_frame")
         super().__init__()

         self.SetSizeHints(self)

python produces this error:

Traceback (most recent call last):
   File "./openEDMS.py", line 274, in <module>
     frame_1 = MainFrame(None)
   File "./openEDMS.py", line 28, in __init__
     self.SetSizeHints(self)
TypeError: TopLevelWindow.SetSizeHints(): arguments did not match any overloaded call:
   overload 1: argument 1 has unexpected type 'MainFrame'
   overload 2: argument 1 has unexpected type 'MainFrame'

   When I comment out self.SetSizeHints(self) trying to invoke the package
results in a segfault:

$ ./openEDMS.py Segmentation fault

   Looking for wxPython4.x docs on this wx.TopLevelWindow tells me,
"SetSizeHints Allows specification of minimum and maximum window sizes,
and window size increments." and I have no idea what values to put in there.
I'm not finding an example in the demos and would like a pointer to an
example.

Rich

Progess has been made: the problem was the structure of the __main__
method at the bottom of the module. Changing it to:

if __name__ == "__main__":
     edms = wx.App(redirect=True)
     top = Frame('openEDMS')
     top = Show()
     edms.MainLoop()

eliminates the SetSizeHints() error and the segfault. However, while the
main module runs without error there's no display on the monitor. Time to
run winpdb, unless someone has a preferred alternative.

Rich

···

On Mon, 23 Apr 2018, Rich Shepard wrote:

Looking for wxPython4.x docs on this wx.TopLevelWindow tells me,
"SetSizeHints Allows specification of minimum and maximum window sizes,
and window size increments." and I have no idea what values to put in
there. I'm not finding an example in the demos and would like a pointer to
an example.

Check demo, I use the same code…

···

2018-04-23 15:26 GMT-05:00 Rich Shepard rshepard@appl-ecosys.com:

On Mon, 23 Apr 2018, Rich Shepard wrote:

Looking for wxPython4.x docs on this wx.TopLevelWindow tells me,

"SetSizeHints Allows specification of minimum and maximum window sizes,

and window size increments." and I have no idea what values to put in

there. I’m not finding an example in the demos and would like a pointer to

an example.

Progess has been made: the problem was the structure of the main

method at the bottom of the module. Changing it to:

if name == “main”:

edms = wx.App(redirect=True)

top = Frame('openEDMS')

top = Show()

edms.MainLoop()

eliminates the SetSizeHints() error and the segfault. However, while the

main module runs without error there’s no display on the monitor. Time to

run winpdb, unless someone has a preferred alternative.

Rich

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Saludos / Best regards

Mario Lacunza
Email:: mlacunza@gmail.com
Personal Website:: http://www.lacunza.biz/
Hosting:: http://mlv-host.com/
Skype: mlacunzav

Lima - Peru

Mario,

   Perhaps I was looking at the wrong demo module: Main.py. The code I'm
using is based on <https://wiki.wxpython.org/wxPython%20by%20Example&gt;:

if __name__ == "__main__":
     edms = wx.App(redirect=True)
     top = MainFrame('openEDMS')
     top = Show()
     edms.MainLoop()

   When I run this from a virtual terminal nothing happens; the bash prompt
is displayed.

   If I change the paramter of wx.App() to 0 then I get the error for
self.SetSizeHints(self):

$ ./openEDMS.py Traceback (most recent call last):
   File "./openEDMS.py", line 274, in <module>
     top = MainFrame('openEDMS')
   File "./openEDMS.py", line 28, in __init__
     self.SetSizeHints(self)
TypeError: TopLevelWindow.SetSizeHints(): arguments did not match any overloaded call:
   overload 1: argument 1 has unexpected type 'MainFrame'
   overload 2: argument 1 has unexpected type 'MainFrame'

   Commenting out 'self.SetSizeHints(self)' throws a different error.

   I'm thoroughly confused and not finding information on the web that
explains what I've done incorrectly.

Rich

···

On Mon, 23 Apr 2018, Mario Lacunza wrote:

Check demo, I use the same code..

Hi,

I use this:

class App(wx.App):

def OnInit(self):
    frame = MySoft(None, wx.ID_ANY, glb.trFreeVersion, size=(850, 590))
    frame.Show()
    self.SetTopWindow(frame)
    return True

def OnExit(self):
    return super().OnExit()

if name == “main”:
app = App(True)
app.MainLoop()

···

2018-04-23 16:11 GMT-05:00 Rich Shepard rshepard@appl-ecosys.com:

On Mon, 23 Apr 2018, Mario Lacunza wrote:

Check demo, I use the same code…

Mario,

Perhaps I was looking at the wrong demo module: Main.py. The code I’m

using is based on <https://wiki.wxpython.org/wxPython%20by%20Example>:

if name == “main”:

edms = wx.App(redirect=True)

top = MainFrame('openEDMS')

top = Show()

edms.MainLoop()

When I run this from a virtual terminal nothing happens; the bash prompt

is displayed.

If I change the paramter of wx.App() to 0 then I get the error for

self.SetSizeHints(self):

$ ./openEDMS.py Traceback (most recent call last):

File “./openEDMS.py”, line 274, in

top = MainFrame('openEDMS')

File “./openEDMS.py”, line 28, in init

self.SetSizeHints(self)

TypeError: TopLevelWindow.SetSizeHints(): arguments did not match any overloaded call:

overload 1: argument 1 has unexpected type ‘MainFrame’

overload 2: argument 1 has unexpected type ‘MainFrame’

Commenting out ‘self.SetSizeHints(self)’ throws a different error.

I’m thoroughly confused and not finding information on the web that

explains what I’ve done incorrectly.

Rich

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Saludos / Best regards

Mario Lacunza
Email:: mlacunza@gmail.com
Personal Website:: http://www.lacunza.biz/
Hosting:: http://mlv-host.com/
Skype: mlacunzav

Lima - Peru

Calling the base class init with no parameters initializes the C++ class but does not create and initialize the UI widget. You either need to call the other version of init with all the parameters, or call the frame’s Create method if you want to delay it until later for some reason.

···

On Monday, April 23, 2018 at 11:40:44 AM UTC-7, Rich wrote:

When the main module is executed with this code:

class MainFrame(wx.Frame):

 def __init__(self, parent):

     wx.Frame.__init__(self, parent=None, id=wx.ID_ANY, title="openEDMS",

                       size=wx.Size(700,400), style=wx.DEFAULT_FRAME_STYLE|

                       wx.TAB_TRAVERSAL, name = "main_frame")

     super().__init__()

Robin

Robin,

   Thank you for pointing out what I was missing, and why it needs
correcting. Starting with this project I want to really understand why
wxPython needs to be written a certain way and not just copy it from another
source.

   The module containing wx.Frame was generated by wxFormBuilder. I keep
finding more things it does incorrectly; e.g., using tabs for block spacing
rather than spaces. I had to globally search and replace tabs with 4 spaces
on each file it produced. So much for 'rapid application development'. Feh!
Back to writing each line in emacs.

Very much appreciated,

Rich

···

On Mon, 23 Apr 2018, Robin Dunn wrote:

Calling the base class __init__ with no parameters initializes the C++
class but does not create and initialize the UI widget. You either need to
call the other version of __init__ with all the parameters, or call the
frame's Create method if you want to delay it until later for some reason.

Rich,

As an aside: Most python IDEs, and emacs can be one, have an option for
automatically replacing any existing tabs with spaces (usually on file
save)

is worth a look as is
Introduction — Elpy 1.35.0 documentation (if you don't
already use elpy).

···

On 24/04/2018 01:51, Rich Shepard wrote:

On Mon, 23 Apr 2018, Robin Dunn wrote:

Calling the base class __init__ with no parameters initializes the C++
class but does not create and initialize the UI widget. You either
need to
call the other version of __init__ with all the parameters, or call the
frame's Create method if you want to delay it until later for some
reason.

Robin,

Thank you for pointing out what I was missing, and why it needs
correcting. Starting with this project I want to really understand why
wxPython needs to be written a certain way and not just copy it from
another
source.

The module containing wx.Frame was generated by wxFormBuilder. I keep
finding more things it does incorrectly; e.g., using tabs for block spacing
rather than spaces. I had to globally search and replace tabs with 4 spaces
on each file it produced. So much for 'rapid application development'. Feh!
Back to writing each line in emacs.

Very much appreciated,

Rich

--
Steve (Gadget) Barnes
Any opinions in this message are my personal opinions and do not reflect
those of my employer.

---
This email has been checked for viruses by AVG.

Steve,

   I've been using emacs for Python (and almost all other writing) for about
20 years now and it does syntax highlighting and proper formatting based on
the .py file extension.

   Many years ago I read someone's description of emacs as the only editor
with it's own operating system, and another's description as an editor which
includes everything, including the kitchen sink.

   A friend who used to work at Sharp Labs used emacs exclusively, including
e-mail and web browsing. And the flame wars between users of emacs and vi
died out long ago, to everyone's relief.

   On the topic of Python IDEs, long ago I tried Glade and a couple of
others. Gave them up. They all emitted code that looked different from the
PEP and I had to redo most of it so there was no advantage --- for me --- to
use any of them. Sadly, wxFormBuilder is equally unsatisfactory.

Best regards,

Rich

···

On Tue, 24 Apr 2018, Steve Barnes wrote:

As an aside: Most python IDEs, and emacs can be one, have an option for
automatically replacing any existing tabs with spaces (usually on file
save)
emacs: Convert python spaces to tabs - Stack Overflow
is worth a look as is
Introduction — Elpy 1.35.0 documentation (if you don't
already use elpy).