wxWidgets / Phoenix

wxPython's Project Phoenix. A new implementation of wxPython, better, stronger, faster than he was before.
http://wxpython.org/
2.32k stars 516 forks source link

Hello World Example on website needs updating. #883

Closed jameslkey closed 6 years ago

jameslkey commented 6 years ago
# First things, first. Import the wxPython package.
import wx

# Next, create an application object.
app = wx.App()

# Then a frame.
frm = wx.Frame(None, title="Hello World")

# Show it.
frm.Show()

# Start the event loop.
app.MainLoop()

This version does not take into account wx.py.frame.Frame()

# First things, first. Import the wxPython package.
import wx
from wx.py import frame

# Next, create an application object.
app = wx.App()

# Then a frame.
frm = frame.Frame(None, title="Hello World")

# Show it.
frm.Show()

# Start the event loop.
app.MainLoop()
DietmarSchwertberger commented 6 years ago

The py package is documented here: https://wxpython.org/Phoenix/docs/html/wx.py.html

The hello world example is about wxPython, not the py package. So, everything is fine.

jameslkey commented 6 years ago

Weird, I guess I’m confused. The example will not run with out the edit. This was brought to my attention by someone following my Raspberry Pi install Tutorial. I’m seeing it here: https://wxpython.org/pages/overview/#hello-world

Sent from Mail for Windows 10

From: Dietmar Schwertberger Sent: Wednesday, June 13, 2018 17:21 To: wxWidgets/Phoenix Cc: James L. Key; Author Subject: Re: [wxWidgets/Phoenix] Hello World Example on website needsupdating. (#883)

The py package is documented here: https://wxpython.org/Phoenix/docs/html/wx.py.html The hello world example is about wxPython, not the py package. So, everything is fine. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

jameslkey commented 6 years ago

It seems the “issue tracker” link on wxPython points to your bug tracker. I’ll let Robin know.

Sent from Mail for Windows 10

From: Dietmar Schwertberger Sent: Wednesday, June 13, 2018 17:21 To: wxWidgets/Phoenix Cc: James L. Key; Author Subject: Re: [wxWidgets/Phoenix] Hello World Example on website needsupdating. (#883)

The py package is documented here: https://wxpython.org/Phoenix/docs/html/wx.py.html The hello world example is about wxPython, not the py package. So, everything is fine. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

DietmarSchwertberger commented 6 years ago

This is the issue tracker for wxPython. So it's the right place to report an issue.

The example is running fine on Windows and I don't see why it should not run anythwere What traceback do you get from the unedited version or does it not show up at all?

DietmarSchwertberger commented 6 years ago

P.S.: I was just following your tutorial yesterday to build wxPython on my new Gemini PDA. Thanks a lot for it. It's working well on Gemian (Debian on Gemini).

jameslkey commented 6 years ago

Okay I’m embarrassed. Yes It’s working for me too. The individual was getting: Traceback (most recent call last):   File "<pyshell#12>", line 1, in     frame = wx.Frame(None, wx.ID_ANY, "Hello World") PyNoAppError: The wx.App object must be created first! Then I pulled it up in PyCharm and the built in inspector fails on wx.Frame() so I jumped to the conclusion that it must be broken. BTW the other way works great too.

I’m glad to hear that! It’s amazing how simple it is to do if you have a checklist to follow. It took MANY days to get it right as there was nothing close to it. Initially I wondered if it would even work, I kept getting out of memory issues on a Raspberry Pi Zero. My whole reason for trying is I am building a Morse code demo for a local Railroad museum. You walk into the small station we have and the Pi detects you with an IR unit. It picks a random message from an SQLite db and plays Morse code though a relay to a real Morse code responder. Simultaneously displaying the message on an LCD display.

Sent from Mail for Windows 10

From: Dietmar Schwertberger Sent: Wednesday, June 13, 2018 17:30 To: wxWidgets/Phoenix Cc: James L. Key; Author Subject: Re: [wxWidgets/Phoenix] Hello World Example on website needsupdating. (#883)

This is the issue tracker for wxPython. So it's the right place to report an issue. The example is running fine on Windows and I don't see why it should not run anythwere What traceback do you get from the unedited version or does it not show up at all? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

DietmarSchwertberger commented 6 years ago

I would guess from the "line 1" that this was tried in a Python shell and not by running python hello_world.py. Then, after some trying, the wx.App() call was made before trying frame.Frame. The error message is clearly complaining about wx.Frame being called before wx.App().

So, I would suggest to close the issue.

It's really cool that wxPython can be built right on such small platforms. For my Sailfish OS phone I could only use Qt which was required to be built on the SDK on a PC.