-2
私は優先順位を管理する簡単なGUIプログラムを作成しています。C#の汎用リストのPythonと同等です<T>
私は正常にリストボックスに項目を追加するための機能を追加するために管理しています。今度は、C#のList <と呼ばれるアイテムにアイテムを追加します。そのようなことはPythonに存在しますか?
List<Priority> priorities = new List<Priority>();
を...そして次のメソッドを作成します:
は例えば、C#で、私が最初に作成し、リストビューにアイテムを追加するには
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 (priorities.Find(x => x.Subject == p.Subject) == null)
{
priorities.Add(p);
listView1.Items.Add(p.Subject);
}
else
{
MessageBox.Show("That priority already exists in your program!");
}
ClearAll();
Sync();
Count();
}
}
SaveAll();
}
"Python list"を検索するための情報が見つかりませんでしたか? – jonrsharpe