473,785 Members | 2,275 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

wxPython tutorial?

I'm trying (without conspicuous success) to start learning
wxPython. Sooo... I opened the doc page wxPythonManual. html#wxpython-overview.
The very first example does not work. Try it. I find much of what follows
to be incomprehensibl e. Is there a good tutorial for novices?

Here's the example that does not work. ("No module named frame")
import wx

from frame import Frame

class App(wx.App):
"""Applicat ion class."""

def OnInit(self):
self.frame = Frame()
self.frame.Show ()
self.SetTopWind ow(self.frame)
return True

def main():
app = App()
app.MainLoop()

if __name__ == '__main__':
main()
Jul 18 '05 #1
6 4557
Jive Dadson wrote:
I'm trying (without conspicuous success) to start learning
wxPython. Sooo... I opened the doc page wxPythonManual. html#wxpython-overview.
The very first example does not work. Try it. I find much of what follows
to be incomprehensibl e. Is there a good tutorial for novices?

Here's the example that does not work. ("No module named frame")

[snip]

Weird. I've never seen imports like that with wxPython before. Try the
following code, instead. Notice that I changed three things: I replaced
the imports, changed "wx.App" and "Frame" to "wxApp" and "wxFrame", and
changed the constructor args for the frame.

from wxPython.wx import *

class App(wxApp):
def OnInit(self):
self.frame = wxFrame(NULL, -1, "MyApp Frame")
self.frame.Show ()
self.SetTopWind ow(self.frame)
return True

def main():
app = App()
app.MainLoop()

if __name__ == '__main__':
main()

I'm not too sure about that tutorial you mentioned, but you can try
these, also:

<http://wxpython.org/tut-part1.php> Starts off almost identical to what
you had (except that this one woks). It's a short tutorial, though.

<http://tinyurl.com/oq0p> Lot's of information.
greg
Jul 18 '05 #2
On 26 Feb 2004 22:55:52 -0800, jd*****@yahoo.c om (Jive
Dadson) wrote:
I'm trying (without conspicuous success) to start learning
wxPython. Sooo... I opened the doc page wxPythonManual. html#wxpython-overview.
The very first example does not work. Try it. I find much of what follows
to be incomprehensibl e. Is there a good tutorial for novices?


While using "import wx" is cleaner the turorials uses often
"from wxpython import * " Thus function and class names are
changed.

change:
self.frame = Frame()
self.frame = wx.Frame()

Jul 18 '05 #3
- Jive Dadson <jd*****@yahoo. com> :
I'm trying (without conspicuous success) to start learning
wxPython.


Take a look at the wiki on the wxPython site.

HTH,
--
__Nicholas Wieland
Flat is better than nested.
__The Zen of Python
Jul 18 '05 #4
On Fri, 27 Feb 2004 09:38:00 GMT, Greg Krohn
<gr**********@c apra.us.invalid > wrote:
Jive Dadson wrote:
I'm trying (without conspicuous success) to start learning
wxPython. Sooo... I opened the doc page wxPythonManual. html#wxpython-overview.
The very first example does not work. Try it. I find much of what follows
to be incomprehensibl e. Is there a good tutorial for novices?

Here's the example that does not work. ("No module named frame")

[snip]

Weird. I've never seen imports like that with wxPython before.


It keeps the namespace clear. see:
http://cvs.osafoundation.org/index.c....html?rev=HEAD

Jul 18 '05 #5
jd*****@yahoo.c om (Jive Dadson) wrote:
I'm trying (without conspicuous success) to start learning
wxPython. Sooo... I opened the doc page wxPythonManual. html#wxpython-overview.
The very first example does not work. Try it. I find much of what follows
to be incomprehensibl e. Is there a good tutorial for novices?

Here's the example that does not work. ("No module named frame")


Probably a bit out-of-date, not using the wx namespace (wxFrame).

Here's a good tutorial: http://wxpython.org/tutorial.php

Which is from http://wiki.wxpython.org/index.cgi/H...arn_20wxPython

All I needed, and much better than TKinter, although I've since moved onto PyQt.
Jul 18 '05 #6
Tjarko de Jong wrote:
On Fri, 27 Feb 2004 09:38:00 GMT, Greg Krohn
<gr**********@c apra.us.invalid > wrote:

Weird. I've never seen imports like that with wxPython before.

It keeps the namespace clear. see:
http://cvs.osafoundation.org/index.c....html?rev=HEAD


Oh, thanks. I'm a little suprised I haven't heard of this before. I must
be living under a rock. It's nice, though. I like it.

/me runs off to fix my code.

greg
Jul 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5957
by: max4 | last post by:
hello i would like to know if there is a good tutorial about how to do this or if someone could explain thank you
4
2888
by: jblazi | last post by:
I am having this problem: I use Python for my teaching and right now we are trying to implement some sort of very simple graphical game the pupils can play across the Internet. For this, we use wxPython. Now it has turned out that wxPython does not implement wxWidget sockets, so we have to use Python sockets instead. Implementing a separate thread for this would be too complicated and I am going to use the wxIdle event to do the socket...
1
1605
by: chris | last post by:
Anybody know of a good wxPython tutorial besides the one on the site?
9
1539
by: David Sulc | last post by:
Hi ! I've looked all over (internet, books, etc.) and I haven't found a very good ressource to get started with wxPython (yes, I've been through their tutorial). What I would basically like to do for starters is to be able to define the main panel being displayed. For example : 1. wxFrame contains a wxPanel (call it mainPanel). 2. mainPanel contains another panel (childPanelA)
16
2417
by: Andrea Gavana | last post by:
Hi Diez & All, Do you mind explaining "why" you find it *buttugly*? I am asking just out of curiosity, obviously. I am so biased towards wxPython that I won't make any comment on this thread in particular, but I am curious to know why some people find it "ugly" or "bad" or whatever. It has its own bugs and missing features, of course, but it is one of the major GUI player in the arena, together with PyQt and PyGTK.
2
2861
tharden3
by: tharden3 | last post by:
Ok, I've been going through these tutorials for both PyGame and wxPython, but I've hit a big speed bump. In each tutorial, I've gotten to the point where I need to "import" or "load" images for various purposes (animation, icons, etc.). Each time I follow the tutorial, I can't quite get it right... please don't tell me "Hey, you can't use the pictures in the tutorial example because those are not the directories, paths, or pics that are on your ...
3
2693
by: teh_sAbEr | last post by:
I'm busy trying to learn wxPython, and i'm trying to run the following piece of code (its from the wxPyWiki tutorial): import wx ID_ABOUT = 101 ID_EXIT = 110 class MainWindow(wx.Frame): def __init__(self,parent,id,title):
0
1817
by: Stef Mientki | last post by:
Peter Anderson wrote: In PyScripter, you should run wxPython in the plain remote machine (not the wxPython remote), and you should set "reset before run flag" or reset the remote machine each time yourself. cheers, Stef
3
18045
by: Netwatcher | last post by:
im try to activate the tutorial code for wxPython, it is working properly when i tell it to import * from wxPython.wx but with an error about the package, i've done as i was told to change the import to wx and change all wxsomething to wx.something but when i start it it gives me an error that say Traceback (most recent call last): File "C:/Python25/Sd", line 32, in <module> app = MyApp(0)
0
10357
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10162
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9959
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7509
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4063
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2893
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.