Python Forum
wxGrid::InsertRows
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
wxGrid::InsertRows
#1
(python 3.6) when using wxGrid::InsertRows function to insert rows, all labels of the rows are reset. Is there a way to keep labels unchanged? Thanks.
Reply
#2
It would be most helpful if you'd provide some code
Reply
#3
I made a sample below. After inserting a row, the last row label is changed to '7'. Thanks

import wx
import wx.grid
import time

app = wx.App()
window = wx.Frame(None, -1, title='Test', size=(960, 850), pos = (-5, 0))
background = wx.Panel(window)
background.SetBackgroundColour("Blue")

grid = wx.grid.Grid(background, size=(800,400), pos=(0,0))
grid.CreateGrid(6,6)
for c in range(6): grid.SetColSize(c,120)
for r in range(6):
    grid.SetRowLabelValue(r,time.strftime('%H:%M:%S'))
    for c in range(6):
        grid.SetCellValue(r, c, "Before Insert: R"+str(r)+"/C"+str(c))
grid.InsertRows(1,1,False)
grid.SetRowLabelValue(1,'Inserted Row')

window.Show()
app.MainLoop()
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  WxGrid Title ian 3 4,327 Jul-09-2017, 05:02 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020