473,466 Members | 1,333 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Python shell sad it has no reference for "frame" but gets it right in another script

8 New Member
I am on a window xp and I've down loaded python 2.7.6 and wxpython 3.3, and i've run the following code
Expand|Select|Wrap|Line Numbers
  1. #import wx
  2.  
  3. class bucky(wx, frame):
  4.  
  5.     def __init__(self, parent,id):
  6.         wx.Frame.__init__(self, prent, id, 'Frame aka window', size = (300,200))
  7.  
  8. if __name__== "__main__":
  9.     app = wx.PySimpleApp()
  10.     frame = bucky(parent = None, id = -1)
  11.     frame.Show()
  12.     app.MainLoop()#
from the new boston and the error message i get back is:

Traceback (most recent call last):
File "C:\Python27\bucky test", line 3, in <module>
class bucky(wx, frame):
NameError: name 'frame' is not defined
what do i do
thank you
Jan 2 '14 #1

✓ answered by dwblas

You misspelled "parent" in wx.Frame.__init__. The following code works for me, your original code does not.
Expand|Select|Wrap|Line Numbers
  1. import wx
  2.  
  3. class bucky(wx.Frame):
  4.     def __init__(self, parent,id):
  5.         wx.Frame.__init__(self, parent, id, 'Frame aka window', size = (300,200))
  6.  
  7. if __name__== "__main__":
  8.     app = wx.PySimpleApp()
  9.     frame = bucky(parent = None, id = -1)
  10.     frame.Show()
  11.     app.MainLoop() 

2 1264
dwblas
626 Recognized Expert Contributor
You misspelled "parent" in wx.Frame.__init__. The following code works for me, your original code does not.
Expand|Select|Wrap|Line Numbers
  1. import wx
  2.  
  3. class bucky(wx.Frame):
  4.     def __init__(self, parent,id):
  5.         wx.Frame.__init__(self, parent, id, 'Frame aka window', size = (300,200))
  6.  
  7. if __name__== "__main__":
  8.     app = wx.PySimpleApp()
  9.     frame = bucky(parent = None, id = -1)
  10.     frame.Show()
  11.     app.MainLoop() 
Jan 2 '14 #2
roryclancy
8 New Member
Thank you
dwbles
liked your answer a lot really helped, while I have you any idea how to get the editor to color code the text Thanks again
Clancypmr
Jan 2 '14 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Nuff Said | last post by:
When I type the following code in the interactive python shell, I get 'UTF-8'; but if I put the code into a Python script and run the script - in the same terminal on my Linux box in which I...
2
by: Jay | last post by:
Is their any way of setting wear the Python Shell window appears on the screen when I run my program? I am testing a full screen program with no Window Frame on a comp with 2 monitors and I have...
1
by: m.n.summerfield | last post by:
Although a fan of Python, I find the Python Library Reference page (lib.html) very inconvenient because of its book contents-like layout. Also, some things that seem to me to belong together, such...
7
by: Bert Heymans | last post by:
Hi! I'm using iTerm on the mac the keymapping isn't right. On Linux and Windows it's really nice to be able to hit up to get the previous command. Does anyone know a way to get the Pyhton shell...
12
by: Krypto | last post by:
I have been using python shell to test small parts of the big program. What other ways can I use the shell effectively. My mentor told me that you can virtually do anything from testing your...
1
by: chewie54 | last post by:
Is there an python example that shows how to include a python shell in a wxPython application. I have looked the wxPython demo but I was wondering if there are any others that might be helpful...
3
by: koutoo | last post by:
Is it possible to display messages in the python shell? I want to display error messages based on parameters in my scripts to the users. Is there another way to display messages other than log...
1
by: Lee | last post by:
Hi, thank your for your reply. I will try iPython. I did try sage for a while, but I found it quite heavy, and I'm not sure whether it's easy to expand like python or not. New libraries can be...
2
by: Ant | last post by:
Hi all, There's a sweet combination of tools that you can assemble using Vim, a Python shell (or any shell for that matter) and GNU screen, where you essentially send selected text from Vim to...
8
by: james.kirin39 | last post by:
Hi everyone, After having used Python on Linux for some time, I now have to do Python coding on Windows. I am big fan of the interactive Python shell to test, eg, regexps. Is there an...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.