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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:21:26+00:00 2026-06-18T06:21:26+00:00

I am trying to create a version of a GridCellChoiceEditor which allows the list

  • 0

I am trying to create a version of a GridCellChoiceEditor which allows the list of choices to be changed at runtime. The reason is that the choices to be presented are the result of a query on my data, so they will probably change every time the editor is used. I am doing this be subclassing PyGridCellEditor, but whenever I run it, it segfaults immediately after creating the editor. Here is my code, simplified for the purposes of testing to use a static list and only one cell:

import wx
import wx.grid

class ListEditor(wx.grid.PyGridCellEditor):

    def __init__(self, options):
        super(ListEditor, self).__init__()
        self.options = options

    def ApplyEdit(self, row, col, grid):
        grid.SetValue(row, col, self.value)

    def BeginEdit(self, row, col, grid):
        print('begin edit')
        value = grid.GetValue(row, col)
        index = self.options.index(value)
        self.combo.SetOptions(self.options)
        self.combo.SetIndex(index)

    def Create(self, parent, id, evtHandler):
        self.combo = wx.ComboBox(parent, id)
        print('combo created')

    def Clone(self):
        return ListEditor(self.options)

    def EndEdit(self, row, col, grid, oldval, newval):
        if oldval == newval:
            return False
        else:
            self.value = newval
            return True

    def Reset(self):
        pass

    def GetValue(self):
        return 'a'


class F(wx.Dialog):

    def __init__(self):
        super(F, self).__init__(None)
        self.grid = wx.grid.Grid(self, -1, (0, 0), (300, 300))
        self.grid.CreateGrid(1, 1)
        editor = ListEditor(['a', 'b', 'c'])
        self.grid.SetCellEditor(0, 0, editor)


app = wx.App(False)
f = F()
f.Show()
app.MainLoop()

Can anyone tell me where I’m going wrong?

  • 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-18T06:21:28+00:00Added an answer on June 18, 2026 at 6:21 am

    In your Create method you need to call self.SetControl(self.combo) to let the editor base class know what is the real control. You should also do self.combo.PushEventHandler(evtHandler) so the proper interactions with the grid are set up.

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

Sidebar

Related Questions

I am trying to create a self-signed SSL certificate using OpenSSL (the version that
I'm trying to create a version string, which is treated as a char* when
I'm using Zend Framework version 1.7.8. I am trying to create a class that
I'm trying to create a bash script which downloads the latest version of PHP
I'm trying to create a LINQ to SQL class that represents the latest version
Im trying to create a custom version of the RequiredAttribute to replace the built
I have just started learning python version 3 and trying to create a file
I'm trying to create a large XML tree in R. Here's a simplified version
I have installed VB.NET express 2010 version and I am trying to create a
I'm trying create a bot which automatically likes Facebook posts. Using Mechanize I can

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.