Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 55015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:18:40+00:00 2026-05-10T17:18:40+00:00

I would like to be able to display Notebook and a TxtCtrl wx widgets

  • 0

I would like to be able to display Notebook and a TxtCtrl wx widgets in a single frame. Below is an example adapted from the wxpython wiki; is it possible to change their layout (maybe with something like wx.SplitterWindow) to display the text box below the Notebook in the same frame?

import wx import wx.lib.sheet as sheet  class MySheet(sheet.CSheet):     def __init__(self, parent):         sheet.CSheet.__init__(self, parent)          self.SetLabelBackgroundColour('#CCFF66')         self.SetNumberRows(50)         self.SetNumberCols(50)   class Notebook(wx.Frame):     def __init__(self, parent, id, title):         wx.Frame.__init__(self, parent, id, title, size=(600, 600))         menubar = wx.MenuBar()         file = wx.Menu()         file.Append(101, 'Quit', '' )         menubar.Append(file, '&File')         self.SetMenuBar(menubar)         wx.EVT_MENU(self, 101, self.OnQuit)         nb = wx.Notebook(self, -1, style=wx.NB_BOTTOM)         self.sheet1 = MySheet(nb)         self.sheet2 = MySheet(nb)         self.sheet3 = MySheet(nb)         nb.AddPage(self.sheet1, 'Sheet1')         nb.AddPage(self.sheet2, 'Sheet2')         nb.AddPage(self.sheet3, 'Sheet3')         self.sheet1.SetFocus()         self.StatusBar()      def StatusBar(self):         self.statusbar = self.CreateStatusBar()      def OnQuit(self, event):         self.Close()   class MyFrame(wx.Frame):     def __init__(self, parent, id, title):         wx.Frame.__init__(self, parent, id, title, wx.DefaultPosition, wx.Size(450, 400))         self.text = wx.TextCtrl(self, -1, style = wx.TE_MULTILINE)         self.Center()  class MyApp(wx.App):     def OnInit(self):         frame = Notebook(None, -1, 'notebook.py')         frame.Show(True)         frame.Center()         frame2 = MyFrame(None, -1, '')         frame2.Show(True)         self.SetTopWindow(frame2)         return True   app = MyApp(0) app.MainLoop() 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T17:18:40+00:00Added an answer on May 10, 2026 at 5:18 pm

    Making two widgets appear on the same frame is easy, actually. You should use sizers to accomplish this.

    In your example, you can change your Notebook class implementation to something like this:

    class Notebook(wx.Frame):     def __init__(self, parent, id, title):         wx.Frame.__init__(self, parent, id, title, size=(600, 600))         menubar = wx.MenuBar()         file = wx.Menu()         file.Append(101, 'Quit', '' )         menubar.Append(file, '&File')         self.SetMenuBar(menubar)         wx.EVT_MENU(self, 101, self.OnQuit)         nb = wx.Notebook(self, -1, style=wx.NB_BOTTOM)         self.sheet1 = MySheet(nb)         self.sheet2 = MySheet(nb)         self.sheet3 = MySheet(nb)         nb.AddPage(self.sheet1, 'Sheet1')         nb.AddPage(self.sheet2, 'Sheet2')         nb.AddPage(self.sheet3, 'Sheet3')         self.sheet1.SetFocus()         self.StatusBar()         # new code begins here:         # add your text ctrl:         self.text = wx.TextCtrl(self, -1, style = wx.TE_MULTILINE)         # create a new sizer for both controls:         sizer = wx.BoxSizer(wx.VERTICAL)         # add notebook first, with size factor 2:         sizer.Add(nb, 2)         # then text, size factor 1, maximized         sizer.Add(self.text, 1, wx.EXPAND)         # assign the sizer to Frame:         self.SetSizerAndFit(sizer) 

    Only the __init__ method is changed. Note that you can manipulate the proportions between the notebook and text control by changing the second argument of the Add method.

    You can learn more about sizers from the official Sizer overview article.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 72k
  • Answers 72k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Yes, create your list like so: <asp:DropDownList ID='Whatever' runat='server' AppendDataBoundItems='True'>… May 11, 2026 at 1:46 pm
  • added an answer In your code, send 'SET SESSION sql_log_bin=0' to MySQL before… May 11, 2026 at 1:46 pm
  • added an answer If you sort out your text file such that the… May 11, 2026 at 1:46 pm

Related Questions

No related questions found

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.