473,231 Members | 1,868 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,231 software developers and data experts.

wx.dialog button event doesn't work

Hello everybody!
I have a program with a button.
When I click on this button a wx.dialog open.
However on my new windows there are two button "Valider" and "Annuler", can you tell me why they don't work, I didn't pass to fix my problem can you help please...
My program:
Expand|Select|Wrap|Line Numbers
  2. import wx
  3. import wx.lib.buttons as buttons
  5. class FenetrePrincipal(wx.Frame):
  6.     def __init__(self, parent, ID, title):
  7.         wx.Frame.__init__(self, parent, ID, title, wx.DefaultPosition, wx.Size(482, 68), style= wx.FRAME_NO_TASKBAR | wx.STAY_ON_TOP )
  9.         #Option Button
  10.         bmpOption = wx.Bitmap('btn_option.png',wx.BITMAP_TYPE_PNG)
  11.         self.btnOption = buttons.GenBitmapButton(self, -1, bmpOption, pos = (2,24),size= (18,18), style=wx.BORDER_NONE)
  12.         self.btnOption.SetToolTipString("Options")
  13.         self.Bind(wx.EVT_BUTTON, self.OnFenetreOptions, self.btnOption)
  15.         #Options Windows
  16.         self.fen = wx.Dialog( None, -1 , "Options", size=(250, 200), style=wx.DEFAULT_DIALOG_STYLE | wx.DIALOG_MODAL)
  18.         label = wx.StaticText(self.fen, -1, "Pseudo :", (20,20))
  19.         self.pseudo = wx.TextCtrl(self.fen, -1, "", size=(110,-1), pos=(100,20))
  21.         label = wx.StaticText(self.fen, -1, "Mot de passe :", (20,45))
  22.         self.pwd = wx.TextCtrl(self.fen, -1,"", size=(110,-1), pos=(100,45),  style=wx.TE_PASSWORD)
  24.         label = wx.StaticText(self.fen, -1, "Lancement automatique :", (20,90))
  25.         self.checkbox = wx.CheckBox(self.fen, -1, pos=(150, 90))
  27.         btnValider = wx.Button(self.fen, 1001, "Valider", pos=(40,135))
  28.         btnValider.SetDefault()
  29.         btnAnnuler = wx.Button(self.fen, 1002, "Annuler", pos=(130,135))
  31.         self.Bind(wx.EVT_BUTTON, self.OnValider,  id = 1001)
  32.         self.Bind(wx.EVT_BUTTON, self.OnAnnuler, id= 1002)
  35.     def OnFenetreOptions(self,event):
  36.         self.fen.Show()
  37.         event.Skip()
  39.     def OnValider(self, event):
  40.         print "Valider"
  41.         self.fen.Destroy()
  43.     def OnAnnuler(self, event):
  44.         print "Annuler"
  45.         self.fen.Destroy()
  47. class MyApp(wx.App):
  48.     def OnInit(self):
  49.         fen = FenetrePrincipal(None, -1, "Title")
  50.         fen.Show(True)
  51.         self.SetTopWindow(fen)
  52.         return True
  54. app = MyApp()
  55. app.MainLoop()
Thank !
Oct 8 '07 #1
1 2309
6,596 Expert 4TB
Expand|Select|Wrap|Line Numbers
  1. # Bind buttons like this:
  2.         btnValider = wx.Button(self.fen, 1001, "Valider", pos=(40,135))
  3.         btnValider.SetDefault()
  4.         btnAnnuler = wx.Button(self.fen, 1002, "Annuler", pos=(130,135))
  6.         btnValider.Bind(wx.EVT_BUTTON, self.OnValider,  id = 1001)
  7.         btnAnnuler.Bind(wx.EVT_BUTTON, self.OnAnnuler, id= 1002)
Per this article.
Oct 8 '07 #2

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

Similar topics

by: Dalan | last post by:
I designed a dialog box with a combo to select individual vendors from a form and its related data for print ouput. Though the dialog box seems to work okay, I apparently do not have the filtering...
by: Jim Heavey | last post by:
Hello, there is something that I am forgetting, I just don't remember what is. I create a form which will server as a dialog box. I set the "CancelButton", "AcceptButton" and the...
by: ronenk | last post by:
I have this code to load an authentication form once my app is loaded. I want the authentication form to be closed if a user is authenticated successfully and to give the option to close app on his...
by: theyas | last post by:
How can I get my code to NOT display two "Open/Save/Cancel/More Info" dialog boxes when using the "Response.WriteFile" method to download a file to IE I've asked about this before and didn't get a...
by: Guadala Harry | last post by:
I have a modal dialog that currently does all of the following except item 4. 1. lets users select a graphic from a list of thumbnails (and when selected, displays the full-size image in a...
by: william | last post by:
Hi All, I have a question about closing a dialog box. The thing is: I have two ASP.NET pages. From one page, I open another page as window.showModalDialog. THere is a button on the second page. On...
by: Zytan | last post by:
I have created a new form from the main form. When I close the main form with the 'x' close button, its Form.FormClosed event is run, but not the dialog's. Is this normal? It is ok /...
by: Iain King | last post by:
Hi. I have a modal dialog whcih has a "Browse..." button which pops up a file selector. This all works fine, but the first thing the user has to do when they open the dialog is select a file, so...
by: VK | last post by:
In the continuation of the discussion at "Making Site Opaque -- This Strategy Feasible?" and my comment at http://groups.google.com/group/comp.lang.javascript/msg/b515a4408680e8e2 I have...
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.