473,385 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to correct attribute error?

'myApp' object has no attribute 'closebtn'

Expand|Select|Wrap|Line Numbers
  1. import wx, os, shutil, fnmatch, sys, textwrap, re
  2. import wx.lib.intctrl
  3.  
  4. class myApp(wx.Frame):
  5.     def __init__(self,parent,id):
  6.         wx.Frame.__init__(self,parent,id,'Export Form', size=(500,500))
  7.         panel =wx.Panel(self)
  8.  
  9.         #Creating Static texts
  10.         text1 =wx.StaticText(panel, -1,"Select Data Source",(150,10),(150,-1),wx.ALIGN_CENTER)
  11.         text1.SetForegroundColour('Blue')
  12.         #text1.SetBackgroundColour('Blue')
  13.  
  14.  
  15.         text2 =wx.StaticText(panel, -1,"Use Chain Seeds",(40,60),(150,-1),wx.ALIGN_LEFT)
  16.         text3 =wx.StaticText(panel, -1,"Use Custom Seeds",(40,90),(200,-1),wx.ALIGN_LEFT)
  17.         text4 =wx.StaticText(panel, -1,"Export template",(140,130),(200,-1),wx.ALIGN_LEFT)
  18.         text5 =wx.StaticText(panel, -1,"Apply Selection",(210,310),(200,-1),wx.ALIGN_LEFT)
  19.         text6 =wx.StaticText(panel, -1,"Return to main menu",(210,360),(200,-1),wx.ALIGN_LEFT)
  20.         # Setting the fonts
  21.         font1 =wx.Font(15, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD)
  22.         font2 =wx.Font(10, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD)
  23.  
  24.         #Applying Fonts
  25.         text1.SetFont(font1)
  26.         text2.SetFont(font2)
  27.         text3.SetFont(font2)
  28.         text4.SetFont(font2)
  29.         text5.SetFont(font2)
  30.         text6.SetFont(font2)
  31.  
  32.         #Creating Buttons
  33.         button1 =wx.Button(panel,label="Export",pos=(75,120),size=(50,30))
  34.         button2 =wx.Button(panel,label="Select Custom Data File",pos=(90,200),size=(150,30))
  35.         button3 =wx.Button(panel,label="",pos=(150,300),size=(50,30))
  36.         button4 =wx.Button(panel,label="",pos=(150,350),size=(50,30))
  37.  
  38.  
  39.         #Creating Radio Buttons
  40.         rb1 =wx.RadioButton(panel, -1,'',(25,60),style=wx.RB_GROUP)
  41.         rb2 =wx.RadioButton(panel, -1,'',(25,90))
  42.  
  43.         self.Bind(wx.EVT_BUTTON, self.closebtn, button1)
  44.  
  45.         def closebtn(self,event):
  46.             self.Close(True)
  47.  
  48. if __name__ == '__main__':
  49.     app=wx.PySimpleApp()
  50.     frame=myApp(parent=None,id=-1)
  51.     frame.Show()
  52.     app.MainLoop()
Feb 3 '11 #1
1 2030
bvdet
2,851 Expert Mod 2GB
Your indentation is incorrect. Move method "closebtn" out to the same indentation as "__init__".
Feb 3 '11 #2

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

Similar topics

0
by: Thomas Nücker | last post by:
Hi! I have the following problem within a program, that is using the python dll. With this program i want to use Tkinter, but after setting all paths i get the following error: Traceback...
4
by: livin | last post by:
my log... INFO urllib.urlopen('http://192.168.1.11/hact/kitchen.asp', urllib.urlencode({'Action': 'hs.ExecX10ByName+Kitchen+Lights%2C+On %2C+100&x=4&y=6'})) INFO INFO File...
5
by: johnny | last post by:
I am getting the following errors: File "H:\xampp\xampp\xampp\python\lib\httplib.py", line 679, in _send_output self.send(msg) File "H:\xampp\xampp\xampp\python\lib\httplib.py", line 646, in...
7
by: erikcw | last post by:
Hi, I'm trying to build a SQL string sql = """INSERT INTO ag ('cid', 'ag', 'test') VALUES(%i, %s, %d)""", (cid, ag, self.data) It raises this error: AttributeError: 'tuple' object has no...
3
by: Eric Mahurin | last post by:
Is there a standard way to get a descriptor object for an arbitrary object attribute - independent of whether it uses the descriptor/ property protocol or not. I want some kind of...
0
by: Matt McCredie | last post by:
I built and installed python 2.5 from source and when I do this: You need `_ssl.pyd' for HTTPSHandler to work. I guess, try to figure out why that wasn't built, then build it. I suppose I...
4
by: Nikhil | last post by:
I have recently written a small module. When I import the module, I always get the error only when I do -- Traceback (most recent call last): File "<stdin>", line 1, in <module>
1
by: =?iso-8859-1?q?KLEIN_St=E9phane?= | last post by:
Hi, I'm on Ubuntu 8.04.1 I've installed lxml with easy_install lxml command. Now, when I load etree I've this error : $ python Python 2.5.2 (r252:60911, Apr 21 2008, 11:12:42)
0
by: =?iso-8859-1?q?KLEIN_St=E9phane?= | last post by:
Le Mon, 25 Aug 2008 13:50:50 +0000, KLEIN Stéphane a écrit : I've this bug only with lxml2, lxml 1.3.3 work very well. Regards, Stephane
2
by: ylj798 | last post by:
my code ------------------------------------------------------------------------------------------- # -*- coding: utf8 -*- #!/usr/bin/python import urllib import urllib2 import re import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...

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.