How about programming it this way?
#import GUI - easyGUI (download with pip required, command - "pip install easygui") from easygui import * #Creating dict item: cost items={'A': 20, 'B': 55, 'C': 10, 'D': 5} #Creating list, where will be items selected by user items_selected=[] #This code will create the pop-up window, which will get the information: Would user like to add item A, next, save the answer in variable, and finally, #add the item if user want to add it x=ynbox('Do you want to add item A (cost: 20$)?', 'App') if x: items_selected.append('A') #The same with other items x=ynbox('Do you want to add item B (cost: 55$)?', 'App') if x: items_selected.append('B') x=ynbox('Do you want to add item C (cost: 10$)?', 'App') if x: items_selected.append('C') x=ynbox('Do you want to add item D (cost: 5$)?', 'App') if x: items_selected.append('D') #Variable "result" will contain totall cost of all items selected by user result=0 #This fragment will add cost of items selected by user to variable "result" for a in items_selected: result+=items[a] #This window will display total cost of the items selected by user msgbox('Total cost of item added: '+str(result), 'App') #KoniecThis way of programming it is shortest, but displays one window to choice items, and the second to display results, not 4 to choice items and the 5th to display results, as the previous app.
#import GUI - easyGUI (download with pip required, command - "pip install easygui") from easygui import * #Creating dict item: cost items={'A': 20, 'B': 55, 'C': 10, 'D': 5} #This window will be multi choice box - you can select one, two, three or four items at once choices=multichoicebox('What items would you like to add?\n Items cost:\nA - 20$\nB - 55$\nC - 10$\nD - 5$', 'App', ['A', 'B', 'C', 'D']) #This fragment will add cost of items selected by user to variable "result" for a in choices: result+=items[a] #This window will display total cost of the items selected by user msgbox('Total cost of item added: '+str(result), 'App')Check both programs. I hope I helped. If you have some questions, write to me.