All pastes #428401 Raw Edit

Mine

public python v1 · immutable
·published 2007-04-07 15:24 UTC
rendered paste body
import wximport osclass PenguinTray(wx.Frame):    #Create Objects    def __init__(self, parent, id, title):        wx.Frame.__init__(self, parent, -1, title, size = (1, 1),            style=wx.FRAME_NO_TASKBAR|wx.NO_FULL_REPAINT_ON_RESIZE)        self.image=['No media']*10        self.tbicon = wx.TaskBarIcon()        self.Show(True)        self.menu=wx.Menu()        self.virtual=wx.Menu()        self.optionsmenu=wx.Menu()        self.virtual0=wx.Menu()        self.layoutstuff()     #Layout the previously created objects    def layoutstuff(self):                icon = wx.Icon('/usr/share/pixmaps/fall-back-wm-select.png', wx.BITMAP_TYPE_PNG)        self.tbicon.SetIcon(icon, 'Penguin Tools')                       self.mountimage0item=wx.MenuItem(self.virtual0, -1, 'Mount Image')        self.virtual0.AppendItem(self.mountimage0item)        self.virtual0.Append(-1,'Unmount Image')                self.virtual.AppendMenu(-1, 'Device 0:[/mnt/cdemu0] '+self.image[0],self.virtual0)        self.virtual.Append(-1, 'Device 1:[/mnt/cdemu1] '+self.image[1] )        self.virtual.Append(-1, 'Device 2:[/mnt/cdemu2] '+self.image[2] )        self.virtual.Append(-1, 'Device 3:[/mnt/cdemu3] '+self.image[3])        self.virtual.Append(-1, 'Device 4:[/mnt/cdemu4] '+self.image[4])        self.virtual.Append(-1, 'Device 5:[/mnt/cdemu5] '+self.image[5])        self.virtual.Append(-1, 'Device 6:[/mnt/cdemu6] '+self.image[6])        self.virtual.Append(-1, 'Device 7:[/mnt/cdemu7] '+self.image[7])        self.virtual.Append(-1, 'Device 8:[/mnt/cdemu8] '+self.image[8])        self.virtual.Append(-1, 'Device 9:[/mnt/cdemu9] '+self.image[9])        self.virtual.AppendSeparator()        self.virtual.Append(-1, 'Unmount all drives')                        self.menu.AppendMenu(-1, "Virtual CD/DVD-ROM",self.virtual)        self.menu.AppendMenu(-1, "Options", self.optionsmenu)        self.menu.AppendSeparator()        self.menu.Append(wx.ID_EXIT, "Exit")                self.Bind(wx.EVT_MENU, self.quit, id=wx.ID_EXIT)        self.Bind(wx.EVT_MENU, self.mountimage0, self.mountimage0item)         wx.EVT_TASKBAR_LEFT_DCLICK(self.tbicon, self.quit)        wx.EVT_TASKBAR_RIGHT_UP(self.tbicon, self.showmenu)            def quit (self, event):        self.Close(True)    def mountimage0(self,event):       dlg = wx.FileDialog(self, "Choose a file", os.getcwd(), "", "*.*", wx.OPEN)       if dlg.ShowModal() == wx.ID_OK:                self.image[0]=dlg.GetPath()                print self.image[0]       dlg.Destroy()            def showmenu(self, event):        self.PopupMenu(self.menu)        #start the appclass PenguinApp(wx.App):    def OnInit(self):        frame = PenguinTray(None, -1, ' ')        frame.Center(wx.BOTH)        frame.Show(False)        return Truedef main():    app = PenguinApp(0)    app.MainLoop()if __name__ == '__main__':    main()