相关疑难解决方法(0)

C# 通用 List<T> 的 Python 等效项

我正在创建一个简单的 GUI 程序来管理优先级。

优先事项

我已经成功地添加了将项目添加到列表框的功能。现在我想将该项目添加到 C# 中称为 List<> 的内容中。Python中存在这样的东西吗?

例如,在 C# 中,要将项目添加到列表视图,我首先要创建:

List<Priority> priorities = new List<Priority>();
Run Code Online (Sandbox Code Playgroud)

...然后创建以下方法:

void Add()
{
    if (listView1.SelectedItems.Count > 0)
    {
        MessageBox.Show("Please make sure you have no priorities selected!", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information);
    }
    else if (txt_Priority.ReadOnly == true) { MessageBox.Show("Please make sure you refresh fields first!", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information); }
    else
    {
        if ((txt_Priority.Text.Trim().Length == 0)) { MessageBox.Show("Please enter the word!", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information); }
        else
        {
            Priority p = new Priority();
            p.Subject = txt_Priority.Text;

            if …
Run Code Online (Sandbox Code Playgroud)

python listview listbox tkinter

5
推荐指数
1
解决办法
8863
查看次数

标签 统计

listbox ×1

listview ×1

python ×1

tkinter ×1