Application Does Not Load; No Errors Reported

This morning I copied Dialog.py from the 3.0.0.0 demo/ directory and
modifed it to function as the application's login dialog. Found and
corrected syntactical errors yet the script does not display the dialog in a
frame.

   Knowing that I missed something that should be included, I ran the script
within winpdb. Unfortunately, the debugger showed me no errors. Both running
it (with the 'Go' button) and stepping through the code went to the end
without displaying anything or indicating an error. At least, my reading of
the debuggee status did not reveal an obvious error to me.

   I've attached the 4k script and would appreciate learning what I did
incorrectly, or left out, that does not reveal what the error might be.
Leaning why I get this response will also be helpful in avoiding it in the
future.

Rich

login.py (3.89 KB)

  This morning I copied Dialog.py from the 3.0.0.0 demo/ directory and
modifed it to function as the application's login dialog. Found and
corrected syntactical errors yet the script does not display the dialog in
a
frame.

  Knowing that I missed something that should be included, I ran the script
within winpdb. Unfortunately, the debugger showed me no errors. Both
running
it (with the 'Go' button) and stepping through the code went to the end
without displaying anything or indicating an error. At least, my reading of
the debuggee status did not reveal an obvious error to me.

  I've attached the 4k script and would appreciate learning what I did
incorrectly, or left out, that does not reveal what the error might be.
Leaning why I get this response will also be helpful in avoiding it in the
future.

Hi Rich. Yes, there are no syntax errors. The issue is just that you
never call frame.Show() to show the frame. So you can add that at the
bottom, like so:

if __name__ == '__main__':
    app = wx.App(False)
    frame = MainFrame(None, -1, "")
    frame.Show() # <----- the missing part
    app.MainLoop()

But, once you do that you'll see that you just have a big grey blank
frame. But this is still not an error, because that is all that is defined
in your MainFrame class.

If, instead, you would like to see the wxDialog you made, you would want
the "frame" to refer to that, so you can change the block above to:

if __name__ == '__main__':
    app = wx.App(False)
    frame = LoginDialog(None, -1, "")
    frame.Show()
    app.MainLoop()

However, when you try to run *that* you will see there are two
AttributeErrors that you will get, but I bet you can figure that out easily
(recall I said AttributeErrors are often pleasant bugs to hunt down), so
I'll leave that as practice. :smiley:

Che

···

On Tue, Jul 8, 2014 at 8:48 PM, Rich Shepard <rshepard@appl-ecosys.com> wrote:

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.

Yes, there are no syntax errors. The issue is just that you never call
frame.Show() to show the frame.

   ...

But, once you do that you'll see that you just have a big grey blank
frame. But this is still not an error, because that is all that is defined
in your MainFrame class.

Che,

   After dinner and being away from the code for a few hours I realized that
I never called the dialog to be displayed. All a result of being away from
coding for so long. I'm sure I'll trip over other issues in the coming
weeks.

   Thank you for the lesson and I will easily track down those attribute
errors when I return from a client meeting this afternoon.

Very much appreciated,

Rich

···

On Tue, 8 Jul 2014, C M wrote:

Dinner and a break is my #1 debugging tool! :smiley: Welcome back to coding,
Che

···

On Wed, Jul 9, 2014 at 9:04 AM, Rich Shepard <rshepard@appl-ecosys.com> wrote:

On Tue, 8 Jul 2014, C M wrote:

Yes, there are no syntax errors. The issue is just that you never call

frame.Show() to show the frame.

  ...

But, once you do that you'll see that you just have a big grey blank

frame. But this is still not an error, because that is all that is defined
in your MainFrame class.

Che,

  After dinner and being away from the code for a few hours I realized that
I never called the dialog to be displayed. All a result of being away from
coding for so long. I'm sure I'll trip over other issues in the coming
weeks.

Che,

   Corrected, and completed code, attached. One question I've not been able
to answer is the purpose of the small box with a '?' in it. Clicking it
changes the cursor to a question mark, but that's all.

   Is this box and action the result of the wx.DIALOG_EX_CONTEXTHELP in pre?
What is it supposed to do?

   And, if it adds no necessary functionality to this login dialog how to
dis-able it? Commenting it out generates new errors so I want to understand
when and where it would be appropriate and how to disable it when not
appropriate. A Web search for wx.PreDialog() brought up nothing relevant.

   I've not yet achieved the correct syntax for presenting two variables in
a wx.MessageBox(); I'll continue my search tomorrow.

Thanks,

Rich

login.py (4.09 KB)

···

On Tue, 8 Jul 2014, C M wrote:

However, when you try to run *that* you will see there are two
AttributeErrors that you will get, but I bet you can figure that out
easily (recall I said AttributeErrors are often pleasant bugs to hunt
down), so I'll leave that as practice. :smiley:

Rich,

···

On Wed, Jul 9, 2014 at 7:51 PM, Rich Shepard rshepard@appl-ecosys.com wrote:

Corrected, and completed code, attached. One question I’ve not been able

to answer is the purpose of the small box with a ‘?’ in it. Clicking it

changes the cursor to a question mark, but that’s all.

Is this box and action the result of the wx.DIALOG_EX_CONTEXTHELP in pre?

I believe so. When I comment it out, it goes away.

What is it supposed to do?

It sets the Dialog to have the ContextHelp functionality. That is explained here:

http://www.wxpython.org/docs/api/wx.ContextHelp-class.html

Essentially, the ? cursor allows you to click on widgets to get help about them, if you have set that up already. I’ve never used it; I have no sense for how much today’s apps tend to use that (I’d guess not as much as they used to? This could be a holdover in the same way that MDI is). It’s sort of a neat idea, actually. That page suggests that invoking this functionality this way is a Windows only option. There is another way on other platforms, as the page mentions.

And, if it adds no necessary functionality to this login dialog how to

dis-able it? Commenting it out generates new errors

Commenting out that line, like so:

#pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)

didn’t give me any errors, but I am using a pretty old version of wxPython right at the moment. What error did you get? Seems like setting a style shouldn’t cause an error, unless it is expecting a style in the next line. I wonder if you put style=0 in that if it would help?

appropriate. A Web search for wx.PreDialog() brought up nothing relevant.

ContextHelp is not just a wx.PreDialog thing, but more general to all widgets, as I understand it.

Che

As far as I can see the only reason for using the pre is to allow
the addition of the extra style so as to allow context help. The
comments make that quite clear. If you did not need this then you
can comment out all 4 lines that mention pre and replace them with a
call to super(LoginDialog, self).init(.
Gadget/Steve

···

On 10/07/14 03:15, C M wrote:

Rich,

          On Wed, Jul 9, 2014 at 7:51 PM, Rich Shepard <rshepard@appl-ecosys.com>
          wrote:
          Corrected, and

completed code, attached. One question I’ve not been able

          to answer is the purpose of the small box with a '?' in

it. Clicking it

          changes the cursor to a question mark, but that's all.



            Is this box and action the result of the

wx.DIALOG_EX_CONTEXTHELP in pre?

I believe so. When I comment it out, it goes away.

What is it supposed to do?

          It sets the Dialog to have the ContextHelp

functionality. That is explained here:

          [http://www.wxpython.org/docs/api/wx.ContextHelp-class.html](http://www.wxpython.org/docs/api/wx.ContextHelp-class.html)
          Essentially, the ? cursor allows you to click on

widgets to get help about them, if you have set that up
already. I’ve never used it; I have no sense for how much
today’s apps tend to use that (I’d guess not as much as
they used to? This could be a holdover in the same way
that MDI is). It’s sort of a neat idea, actually. That
page suggests that invoking this functionality this way is
a Windows only option. There is another way on other
platforms, as the page mentions.

          And, if it adds no necessary functionality to this login

dialog how to

          dis-able it? Commenting it out generates new errors

Commenting out that line, like so:

          #pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
          didn't give me any errors, but I am using a pretty old

version of wxPython right at the moment. What error did
you get? Seems like setting a style shouldn’t cause an
error, unless it is expecting a style in the next line. I
wonder if you put style=0 in that if it would help?

          appropriate. A Web

search for wx.PreDialog() brought up nothing relevant.

          ContextHelp is not just a wx.PreDialog thing, but more

general to all widgets, as I understand it.

Che

  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](https://groups.google.com/d/optout).
  •  parent, ID, title, pos,
    

size, style)*

Gadget/Steve,

   I had commented out all the pre. and post. but did not replace them with
the super() function. That's the step I missed.

   Why the slashes sourrounding the init attributes?

Thanks,

Rich

···

On Thu, 10 Jul 2014, Steve Barnes wrote:

As far as I can see the only reason for using the pre is to allow the
addition of the extra style so as to allow context help. The comments make
that quite clear. If you did not need this then you can comment out all 4
lines that mention pre and replace them with a call to super(LoginDialog,
self).__init__(/parent, ID, title, pos, size, style)/.

Gadget/Steve, Che:

   Germane to my first response: all I need in the final parentheses is
parent.

   What puzzles me, however, is that removing the three pre. and one post.
lines leaves that small question mark box in place. I'm not seeing where it
is generated when the four lines referring to the extra style are removed.
More examination to follow.

Thanks to both of you,

Rich

···

On Thu, 10 Jul 2014, Steve Barnes wrote:

As far as I can see the only reason for using the pre is to allow the
addition of the extra style so as to allow context help. The comments make
that quite clear. If you did not need this then you can comment out all 4
lines that mention pre and replace them with a call to super(LoginDialog,
self).__init__(/parent, ID, title, pos, size, style)/.

Got it:

   if wx.Platform != "__WXMSW__":
             btn = wx.ContextHelpButton(self)
             btnSizer.AddButton(btn)

   I assume that WXMSW is a Microsoft thingie; I removed the three lines and
the button disappeared.

Rich

···

On Thu, 10 Jul 2014, Rich Shepard wrote:

What puzzles me, however, is that removing the three pre. and one post.
lines leaves that small question mark box in place. I'm not seeing where
it is generated when the four lines referring to the extra style are
removed. More examination to follow.

Rich Shepard wrote:

   Corrected, and completed code, attached. One question I've not been able
to answer is the purpose of the small box with a '?' in it. Clicking it
changes the cursor to a question mark, but that's all.

Have you really never seen this in action in a Windows dialog? The idea
is that you click the ?, which changes the cursor to a question mark.
Then, you click on some control in the dialog. Instead of doing the
regular action, the dialog is then supposed to pop up a bubble help box
that explains what that control is for.

This was big in XP, but no one does it any more.

   Is this box and action the result of the wx.DIALOG_EX_CONTEXTHELP in pre?

Yes. If you are not providing bubble help, then you should remove that bit.

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Tim,

   Nope. Haven't used any Microsoft since 1997. Red Hat from 1997-2003;
Slackware since then. :slight_smile:

Rich

···

On Thu, 10 Jul 2014, Tim Roberts wrote:

Have you really never seen this in action in a Windows dialog?