Re: Teclas ALT+F4

Moises Brenes <[email protected]>
Newsgroups gmane.comp.python.general.castellano
Message-ID <[email protected]>
2009/7/27 Manuel Enrique González Ramírez <[email protected]>:
> Cordial saludo,
>
> Quisiera saber como hago para detectar que se han pulsado las combinaciones
> de las teclas ALT+F4 (para cierre de forms) o si existe alguna forma de
> desactivar estas teclas mientras se está ejecutando mi aplicación.
>
>
El evento se llama:
wx.CloseEvent

Ejemplo tomado de http://zetcode.com/wxpython/events/

#!/usr/bin/python

# veto.py

import wx

class Veto(wx.Frame):
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title, size=(250, 200))


        self.Bind(wx.EVT_CLOSE, self.OnClose)

        self.Centre()
        self.Show(True)

    def OnClose(self, event):

        dial = wx.MessageDialog(None, 'Are you sure to quit?', 'Question',
            wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
        ret = dial.ShowModal()
        if ret == wx.ID_YES:
            self.Destroy()
        else:
            event.Veto()


app = wx.App()
Veto(None, -1, 'Veto')
app.MainLoop()



-- 
シャカ
mbrenes.blogspot.com | sibu.homelinux.org
Geloof is een wens om niet te weten wat echt is

_______________________________________________
Lista de correo Python-es 
http://listas.aditel.org/listinfo/python-es
FAQ: http://listas.aditel.org/faqpyes
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.