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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T02:44:59+00:00 2026-05-19T02:44:59+00:00

If I set the format of the first column in a ListCtrl to align

  • 0

If I set the format of the first column in a ListCtrl to align centre (or align right) nothing happens. It works for the other columns.

This only happens on Windows – I have tested it on Linux and it works fine.
Does anyone know if there is a work-round or other solution?

Here is an example based on code found at http://zetcode.com/wxpython/

import wx
import sys

packages = [('jessica alba', 'pomona', '1981'), ('sigourney weaver', 'new york',    '1949'),
    ('angelina jolie', 'los angeles', '1975'), ('natalie portman', 'jerusalem', '1981'),
    ('rachel weiss', 'london', '1971'), ('scarlett johansson', 'new york', '1984' )]

class Actresses(wx.Frame):
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title, size=(380, 230))

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        panel = wx.Panel(self, -1)

        self.list = wx.ListCtrl(panel, -1, style=wx.LC_REPORT)
        self.list.InsertColumn(0, 'name', wx.LIST_FORMAT_CENTRE,width=140)
        self.list.InsertColumn(1, 'place', wx.LIST_FORMAT_CENTRE,width=130)
        self.list.InsertColumn(2, 'year', wx.LIST_FORMAT_CENTRE, 90)

        for i in packages:
            index = self.list.InsertStringItem(sys.maxint, i[0])
            self.list.SetStringItem(index, 1, i[1])
            self.list.SetStringItem(index, 2, i[2])

        hbox.Add(self.list, 1, wx.EXPAND)
        panel.SetSizer(hbox)

        self.Centre()
        self.Show(True)

app = wx.App()
Actresses(None, -1, 'actresses')
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. Editorial Team
    Editorial Team
    2026-05-19T02:44:59+00:00Added an answer on May 19, 2026 at 2:44 am

    I have found that this works (notice I start inserting the columns at 1 rather than 0):

        self.list = wx.ListCtrl(panel, -1, style=wx.LC_REPORT)
        self.list.InsertColumn(1, 'name', wx.LIST_FORMAT_CENTRE,width=140)
        self.list.InsertColumn(2, 'place', wx.LIST_FORMAT_CENTRE,width=130)
        self.list.InsertColumn(3, 'year', wx.LIST_FORMAT_CENTRE, 90)
    

    Not sure why this works, but it does. Hopefully, there will be no repercussions from doing this.

    Thanks to robots.jpg for inspiring the idea.

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

Sidebar

Related Questions

I set up 404 handler page in web.config, but it works ONLY when extension
Introduction I have a ListView and want to format only the second column. The
How do you globally set the date format in ASP.NET? My local machine and
I would like to set some initial variables (like format compact and the current
:set ic ignores the case. How do you unset this?
I set up a website to use SqlMembershipProvider as written on this page .
I have a tab-delimited text file that I am parsing. Its first column contains
I set a passphrase when creating a new SSH key on my laptop. But,
The set up for apache-jmeter allows for a URL to be sent to a
Foo* set = new Foo[100]; // ... delete [] set; You don't pass the

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.