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 8396125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:27:47+00:00 2026-06-09T20:27:47+00:00

I am starting using wx for my Python application and I run in a

  • 0

I am starting using wx for my Python application and I run in a small problem when trying to include an image in a Frame.

I compiled this into a simple example.
What I dont understand is that I have no problem of layout when replacing my image by text. Whe I try entering the image, the layout gets ruined.

Here is my layout with text, that contains only two elements. The logo, and the title of the application

layout with text

And here is what I got when trying to insert the logo :

layout with image

For some reason, the layout is ruined, and the title is placed on top left corner (and we can’t see it anymore.)

Here is my code :

#!/usr/bin/env python
import wx

class IvolutionWindow(wx.Frame):
    def __init__(self, parent, title):
        wx.Frame.__init__(self, parent, title=title, size=(200, 100))
        self.panel = wx.Panel(self)
        # Creating the title layout
        title = self.setup_titlelayout()

        # Creating the main grid
        maingrid = self.setup_maingrid(title)
        self.panel.SetSizer(maingrid)
        self.panel.Layout()
        self.Show(True)

    def setup_titlelayout(self):
        hbox = wx.BoxSizer(wx.HORIZONTAL)  # used to contain logo part and text part
        vbox = wx.BoxSizer(wx.VERTICAL)  # used to separate title and one-liner
        logobox = wx.BoxSizer(wx.HORIZONTAL)

        wx_logo = wx.EmptyBitmap(1, 1)  # Create a bitmap container object.
        wx_logo.LoadFile("ivolution/data/media/vitruve_50.jpg", wx.BITMAP_TYPE_ANY)  # Load it with a file image.

        #logo = wx.StaticBitmap(self, 1, wx_logo)
        logo = wx.StaticText(self.panel, label="Logo Here")  # Change for proper logo
        title = wx.StaticText(self.panel, label="Ivolution")

        logobox.Add(logo)
        vbox.Add(title, flag=wx.RIGHT, border=8)

        hbox.Add(logobox, flag=wx.RIGHT, border=8)
        hbox.Add(vbox, flag=wx.RIGHT, border=8)

        return hbox

    def setup_maingrid(self, title):
        maingrid = wx.FlexGridSizer(4, 1, vgap=0, hgap=0)
        maingrid.Add(title)
        return maingrid

    def on_exit(self, event):
        self.Close(True)  # Close the frame.

if __name__ == "__main__":
    app = wx.App(False)
    frame = IvolutionWindow(None, "Ivolution")
    app.MainLoop()  # Runs application

It should run on any computer if you change the location of the image to a correct one.

The only line of code changing between the two pictures is here :

#logo = wx.StaticBitmap(self, 1, wx_logo)

logo = wx.StaticText(self.panel, label="Logo Here")  # Change for proper logo

I am new with wxPython, so I guess there is something obvious here, but I can’t find what.

  • 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-06-09T20:27:48+00:00Added an answer on June 9, 2026 at 8:27 pm

    You should use the same parent for the StaticText and the StaticBitmap if you want the same effect.
    Thus use:

    logo = wx.StaticBitmap(self.panel, 1, wx_logo)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm starting a basic application using Python and PyQt and could use some experienced
I'm starting to develop a facebook application using Django. I'm trying to choose the
When starting a django application using python manage.py shell , I get an InteractiveConsole
I am trying to run an awk script using python, so I can process
I'm a python newbie and starting out with using the Bottle web framework on
I'm new to Python and am starting to teach myself GUI programming (hopefully) using
I am using Python 2.5, I want an enumeration like so (starting at 1
I am trying to export a public key from openssl using python. I have
We have a Python application that polls directories using threads and inotify watchers. We
I'm developing a dictionary kind of application using python. In my code, there is

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.