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

  • SEARCH
  • Home
  • 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 6905813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:13:48+00:00 2026-05-27T08:13:48+00:00

I’m building an app that should contain a resizable sidebar area on the left

  • 0

I’m building an app that should contain a resizable sidebar area on the left (starting at 200px width) and a main area on the right that should expand to fill the remaining area. I’ve gone with the SplitterWindow method as it’s the only one I think offers manual resize on panels. I’m experiencing some black borders around the individual panels AND the entire frame that I can’t seem to get rid of. The borders on the individual panels disappear when I comment out the make_canvas calls, but the border on the frame is still there. Strangely enough if I resize the entire app window the borders flicker on and off. I suspect it’s not actually a border issue but a BoxSizing issue, but I’m not sure how to take care of it.

Here’s the code:

#! /usr/bin/python
# -*- coding: utf-8 -*-

import wx, random


class TDTaskBarIcon(wx.TaskBarIcon):

    def __init__(self, parent):
        wx.TaskBarIcon.__init__(self)
        self.parentApp = parent
        self.icon = wx.Icon("images/icon_glasses.png", wx.BITMAP_TYPE_PNG)
        self.SetIconImage()

    def SetIconImage(self):
        self.SetIcon(self.icon)


class Sidebar(wx.Panel):
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        # tiled background
        self.bgimage = wx.Bitmap('images/noise.png')
        wx.FutureCall(50, self.make_canvas)
        wx.EVT_SIZE(self, self.make_canvas)
        self.SetBackgroundColour((229,226,218))

    def make_canvas(self, event=None):
        dc = wx.ClientDC(self)
        brush_bmp = wx.BrushFromBitmap(self.bgimage)
        dc.SetBrush(brush_bmp)
        w, h = self.GetClientSize()
        dc.DrawRectangle(0, 0, w, h)


class Main(wx.Panel):
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        # tiled background
        self.bgimage = wx.Bitmap('images/noise.png')
        wx.FutureCall(50, self.make_canvas)
        wx.EVT_SIZE(self, self.make_canvas)
        self.SetBackgroundColour((229,226,218))
        self.SetBackgroundColour('WHITE')

    def make_canvas(self, event=None):
        dc = wx.ClientDC(self)
        brush_bmp = wx.BrushFromBitmap(self.bgimage)
        dc.SetBrush(brush_bmp)
        w, h = self.GetClientSize()
        dc.DrawRectangle(0, 0, w, h)


# Create Tapedeck class
class Tapedeck(wx.Frame):

    def __init__(self, parent):
        wx.Frame.__init__(self, parent)

        self.tbicon = TDTaskBarIcon(self)  
        self.tbicon.Bind(wx.EVT_MENU, self.OnQuit, id=wx.ID_EXIT)

        splitter = wx.SplitterWindow(self)
        self.Sidebar = Sidebar(splitter)
        self.Main = Main(splitter)
        splitter.SplitVertically(self.Sidebar, self.Main)
        splitter.SetSashPosition(200)
        splitter.SetMinimumPaneSize(200)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(splitter, 1, wx.EXPAND)
        self.SetSizerAndFit(sizer)
        self.SetAutoLayout(True)

        self.InitUI()
        self.SetSize((800, 600))
        self.SetTitle('Tapedeck')
        self.Center()
        self.Show(True)

    def InitUI(self):

        panel = wx.Panel(self)

        # font styles
        header = wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD, False, u'Helvetica')

        # create a menubar at the top of the user frame
        menuBar = wx.MenuBar()

        # create menus
        fileMenu = wx.Menu()
        helpMenu = wx.Menu()

        # export
        export = fileMenu.Append(wx.NewId(), "&Export", "Export Playlist",
                                     wx.ITEM_NORMAL)
        export.SetBitmap(wx.Bitmap('images/men_playlist.png'))

        fileMenu.AppendSeparator()

        # quit
        quit = fileMenu.Append(wx.NewId(), "&Quit\tCtrl+Q", "Quit the program",
                                   wx.ITEM_NORMAL)
        quit.SetBitmap(wx.Bitmap('images/men_quit.png'))
        self.Bind(wx.EVT_MENU, self.OnQuit, quit)

        # put the file menu on the menubar
        menuBar.Append(fileMenu, "&File")

        # about tapedeck
        about = helpMenu.Append(wx.NewId(), "&About TapeDeck",
                                    "About TapeDeck", wx.ITEM_NORMAL)
        about.SetBitmap(wx.Bitmap('images/men_skull.png'))
        self.Bind(wx.EVT_MENU, self.OnAbout, about)

        # put the help menu on the menubar
        menuBar.Append(helpMenu, "&Help")

        # set menu bar
        self.SetMenuBar(menuBar)

        # create a status bar at the bottom of the frame
        self.CreateStatusBar()

    def OnQuit(self, e):
        self.tbicon.RemoveIcon()  
        self.tbicon.Destroy()
        self.Close()

    def OnAbout(self, e):
        self.SetStatusText("Here's your help!")


# Run the application
def main():
    deck = wx.App()
    Tapedeck(None)
    deck.MainLoop()    

if __name__ == '__main__':
    main()

And screenshots:

Before resize (source):

Before resize.

After resize (source):

After resize.

Suggestions?

  • 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. Editorial Team
    Editorial Team
    2026-05-27T08:13:49+00:00Added an answer on May 27, 2026 at 8:13 am

    You are drawing those lines with the call to DrawRectangle.
    If you want to eliminate the lines and still draw the rectangle you can do:

    dc.SetPen(wx.Pen("WHITE",1))
    dc.DrawRectangle(0, 0, w, h)
    

    in the two make_canvas methods. It works in windows.

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

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
I have a text area in my form which accepts all possible characters from

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.