'myApp' object has no attribute 'closebtn'
Code:
import wx, os, shutil, fnmatch, sys, textwrap, re
import wx.lib.intctrl
class myApp(wx.Frame):
def __init__(self,parent,id):
wx.Frame.__init__(self,parent,id,'Export Form', size=(500,500))
panel =wx.Panel(self)
#Creating Static texts
text1 =wx.StaticText(panel, -1,"Select Data Source",(150,10),(150,-1),wx.ALIGN_CENTER)
text1.SetForegroundColour('Blue')
#text1.SetBackgroundColour('Blue')
text2 =wx.StaticText(panel, -1,"Use Chain Seeds",(40,60),(150,-1),wx.ALIGN_LEFT)
text3 =wx.StaticText(panel, -1,"Use Custom Seeds",(40,90),(200,-1),wx.ALIGN_LEFT)
text4 =wx.StaticText(panel, -1,"Export template",(140,130),(200,-1),wx.ALIGN_LEFT)
text5 =wx.StaticText(panel, -1,"Apply Selection",(210,310),(200,-1),wx.ALIGN_LEFT)
text6 =wx.StaticText(panel, -1,"Return to main menu",(210,360),(200,-1),wx.ALIGN_LEFT)
# Setting the fonts
font1 =wx.Font(15, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD)
font2 =wx.Font(10, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD)
#Applying Fonts
text1.SetFont(font1)
text2.SetFont(font2)
text3.SetFont(font2)
text4.SetFont(font2)
text5.SetFont(font2)
text6.SetFont(font2)
#Creating Buttons
button1 =wx.Button(panel,label="Export",pos=(75,120),size=(50,30))
button2 =wx.Button(panel,label="Select Custom Data File",pos=(90,200),size=(150,30))
button3 =wx.Button(panel,label="",pos=(150,300),size=(50,30))
button4 =wx.Button(panel,label="",pos=(150,350),size=(50,30))
#Creating Radio Buttons
rb1 =wx.RadioButton(panel, -1,'',(25,60),style=wx.RB_GROUP)
rb2 =wx.RadioButton(panel, -1,'',(25,90))
self.Bind(wx.EVT_BUTTON, self.closebtn, button1)
def closebtn(self,event):
self.Close(True)
if __name__ == '__main__':
app=wx.PySimpleApp()
frame=myApp(parent=None,id=-1)
frame.Show()
app.MainLoop()
Comment