469,361 Members | 2,313 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,361 developers. It's quick & easy.

Embedding a close button in a WxNoteBook

Hi there,

Gotta problem n embedding a close button in the notebook

Lemme know if there are any specific method of doing it!!

To be specific, i need it look like the close tab in mozille r fire fox browsers
Sep 1 '06 #1
1 3152
bartonc
6,596 Expert 4TB
Try this:

#!/usr/bin/env python
# -*- coding: ISO-8859-1 -*-
# generated by wxGlade 0.4 on Tue Sep 12 14:43:34 2006

import wx

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.notebook_1 = wx.Notebook(self, -1, style=0)
self.notebook_1_pane_1 = wx.Panel(self.notebook_1, -1)
self.button_1 = wx.Button(self.notebook_1_pane_1, -1, "button_1")

self.__set_properties()
self.__do_layout()

self.Bind(wx.EVT_BUTTON, self.OnCloseButton, self.button_1)
# end wxGlade

def __set_properties(self):
# begin wxGlade: MyFrame.__set_properties
self.SetTitle("frame_1")
# end wxGlade

def __do_layout(self):
# begin wxGlade: MyFrame.__do_layout
sizer_1 = wx.BoxSizer(wx.VERTICAL)
sizer_2 = wx.BoxSizer(wx.HORIZONTAL)
sizer_2.Add(self.button_1, 0, wx.ADJUST_MINSIZE, 0)
self.notebook_1_pane_1.SetAutoLayout(True)
self.notebook_1_pane_1.SetSizer(sizer_2)
sizer_2.Fit(self.notebook_1_pane_1)
sizer_2.SetSizeHints(self.notebook_1_pane_1)
self.notebook_1.AddPage(self.notebook_1_pane_1, "tab1")
sizer_1.Add(self.notebook_1, 1, wx.EXPAND, 0)
self.SetAutoLayout(True)
self.SetSizer(sizer_1)
sizer_1.Fit(self)
sizer_1.SetSizeHints(self)
self.Layout()
# end wxGlade

def OnCloseButton(self, event): # wxGlade: MyFrame.<event_handler>
print "Event handler `OnCloseButton' not implemented!"
event.Skip()

# end of class MyFrame


class MyApp(wx.App):
def OnInit(self):
wx.InitAllImageHandlers()
frame_1 = MyFrame(None, -1, "")
self.SetTopWindow(frame_1)
frame_1.Show()
return 1

# end of class MyApp

if __name__ == "__main__":
app = MyApp(0)
app.MainLoop()
Sep 12 '06 #2

Post your reply

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

Similar topics

reply views Thread by Gandalf | last post: by
reply views Thread by klaus.roedel | last post: by
3 posts views Thread by mardif | last post: by
reply views Thread by Budhi Saputra Prasetya | last post: by
reply views Thread by Soren | last post: by
5 posts views Thread by Anil Gupte | last post: by
2 posts views Thread by devnew | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.