Bonsoir les amis, vacanciers ou non !

Je crée une fenêtre avec (notamment) un bouton grâce à wxGlade.
Je ne comprends pas pourquoi, quand je clique sur le bouton, la fonction afférente, cliquesurbouton, est exécutée deux fois systématiquement...

Bon, ok, c'est un problème de débutant. Mais je suis débutant, alors...

Merci d'avance !

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
 
#!/usr/bin/env python
# -*- coding: iso-8859-15 -*-
# generated by wxGlade 0.6.3 on Tue Jul 22 18:24:45 2008
 
import wx
import wx.grid
 
# begin wxGlade: extracode
# end wxGlade
 
 
 
class MyFrame(wx.Frame):
	def __init__(self, *args, **kwds):
		# begin wxGlade: MyFrame.__init__
		kwds["style"] = wx.DEFAULT_FRAME_STYLE
		wx.Frame.__init__(self, *args, **kwds)
		self.button_1 = wx.Button(self, -1, "Ajouter une colonne !")
		self.grid_1 = wx.grid.Grid(self, -1, size=(1, 1))
 
		self.__set_properties()
		self.__do_layout()
 
		self.Bind(wx.EVT_BUTTON, self.cliquesurbouton, self.button_1)
		self.Bind(wx.grid.EVT_GRID_CMD_CELL_LEFT_CLICK, self.cliquesurcellule, self.grid_1)
		# end wxGlade
 
	def __set_properties(self):
		# begin wxGlade: MyFrame.__set_properties
		self.SetTitle("frame_1")
		_icon = wx.EmptyIcon()
		_icon.CopyFromBitmap(wx.Bitmap("C:\\Documents and Settings\\DELAR\\Bureau\\Bzzz.ico", wx.BITMAP_TYPE_ANY))
		self.SetIcon(_icon)
		self.SetFocus()
		self.grid_1.CreateGrid(10, 3)
		self.grid_1.SetLabelBackgroundColour(wx.Colour(216, 191, 216))
		# end wxGlade
 
	def __do_layout(self):
		# begin wxGlade: MyFrame.__do_layout
		sizer_1 = wx.BoxSizer(wx.VERTICAL)
		sizer_1.Add(self.button_1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
		sizer_1.Add(self.grid_1, 1, wx.ALL|wx.EXPAND, 5)
		self.SetSizer(sizer_1)
		sizer_1.Fit(self)
		self.Layout()
		# end wxGlade
 
	def pouet(self, event): # wxGlade: MyFrame.<event_handler>
		print "Event handler `pouet' not implemented"
		event.Skip()
 
	def cliquesurbouton(self, event): # wxGlade: MyFrame.<event_handler>
		print "Event handler `cliquesurbouton' not implemented"
		self.grid_1.AppendCols(1)
		event.Skip()
 
	def cliquesurcellule(self, event): # wxGlade: MyFrame.<event_handler>
		print "Event handler `cliquesurcellule' not implemented"
		event.Skip()
 
# end of class MyFrame
 
 
if __name__ == "__main__":
	app = wx.PySimpleApp(0)
	wx.InitAllImageHandlers()
	frame_1 = MyFrame(None, -1, "")
	app.SetTopWindow(frame_1)
	frame_1.Show()
	app.MainLoop()