vaughn
vaughn

Reputation: 71

What are the uses of IDs in wxpython example wx.ID_EXIT

I am doing a lesson in wxpython with zetcode. I'd like to know what are the uses of id. example wx.ID_EXIT. the tutorial says "The standard id will automatically add an icon and a shortcut" but i cant see any icons when i run the program. I'm using windows 7 btw.

Upvotes: 1

Views: 926

Answers (1)

Mike Driscoll
Mike Driscoll

Reputation: 33111

Windows 7 may not have a default exit icon or it may not be active in the theme that is currently in use. You should try cycling through the themes on your machine and see if you get an icon in any of them. I created the following simple example:

import wx

########################################################################
class MyPanel(wx.Panel):
    """"""

    #----------------------------------------------------------------------
    def __init__(self, parent):
        """Constructor"""
        wx.Panel.__init__(self, parent)

        exit_btn = wx.Button(self, wx.ID_EXIT)



########################################################################
class MyFrame(wx.Frame):
    """"""

    #----------------------------------------------------------------------
    def __init__(self):
        """Constructor"""
        wx.Frame.__init__(self, None, title="IDs")
        panel = MyPanel(self)
        self.Show()

if __name__ == "__main__":
    app = wx.App(False)
    frame = MyFrame()
    app.MainLoop()

On Windows 7, I don't get an icon either. But if I run this code on Xubuntu, I get the following:

enter image description here

Upvotes: 1

Related Questions