I am creating a simple GUI program to manage priorities.
I have successfully managed to add functionality to add an item to the listbox. Now I want to add the item to the something what is known as List<> in C#. Does such a thing exist in Python?
For instance, in C#, to add an item to the listview I would first create:
List<Priority> priorities = new List<Priority>();
...and then create the following method:
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();
}