【问题标题】:what does -1 indicate in wx.ListCtrl in wxpython-1 在 wxpython 中的 wx.ListCtrl 中表示什么
【发布时间】:2021-02-19 04:41:35
【问题描述】:

谁能帮助我知道 -1 在以下代码行中表示什么?

self.lst2 = wx.ListCtrl(self.right_panel, -1, style=wx.LC_LIST)

另外,('') 在下面的代码行中表示什么?

self.lst1.InsertItem(0, '')

【问题讨论】:

  • 这个问题似乎与 Stack Overflow 无关,请参阅 How to Askhelp center
  • -1 = wx.ID_ANY = wx.NewIdRef() = 我不在乎你给这个对象的 ID,只要确保它有一个。 self.lst1.InsertItem(0, '') - 在 listctrl 的第一个位置插入一个空格。

标签: python wxpython wxwidgets


【解决方案1】:

@Bhagya,

第一个问题:

在该代码中,sn-p -1 是控件的 ID。

您可以分配自己的 ID,但 -1 表示您让 wxPython 为您分配 ID。

第二个问题:

这意味着您正在将空字符串插入到控件中。

请参阅documentation 了解更多信息。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-10
    • 2012-01-20
    • 2023-04-01
    相关资源
    最近更新 更多