Python Forum
How can I display dictionary in a gui window in Python?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How can I display dictionary in a gui window in Python?
#1
I would recommend to run my code (it uses EasyGui), here in github: https://github.com/UnknownBob123/The-pro...n/TEST1.py

When I click the 'Find' button on the easygui options window in my program, I type the name of the 'card' I want to search for, and then I press OK, and it displays it in a EasyGui window. However, when I add a card, I want it to do exactly that as the 'find' function, but instead display the inputted code when you click on "Add Card". And I also am struggling to find a way to display the card details for the 'delete' option, exactly as the find option but to display the card you want to delete in a gui window.

This is probably a simple manipulation of the show_menu() function, however I am not sure how to alter the add_items() function and delete() function to display the card details in a gui window.

I would appreciate any help to display the card details in a separate gui window, just like the "Find" button. The find button is the only button that shows the card details, apart from the output button which shows the entire nested dictionary.

This is the find button, where the details actually pop-up, you may get an idea of where I am getting at with the delete/add card option.

def search(): 

  '''Searches for specified combo in the menu. 
    If the combo is in the menu, the combo details are displayed on 
    screen. Otherwise, the user is told that there is no such combo 
    and given the option to add the combo. 
  ''' 
  msg = "Enter card name:" 
  title = "Card to search for" 
  search = easygui.enterbox(msg, title) 



  # Calls function to check whether the combo already exists 

  combo = check_exists(search) 

  if combo: 

      # Calls function to display combo details on screen. 

      show_menu(combo)


  else: 

      # If the combo does not exist, the user is told this and 

      # given the option to add the combo. 

      msg = "There is no such combo on the menu.\nWould you like to add the combo?" 
      title = "Card does not exist" 
      choices = ["Yes", "No"] 
      add = easygui.buttonbox(msg, title, choices) 

      if add == "Yes": 
        add_combo() # Calls function to add a combo.
Reply
#2
You should change the search function to use the choice box. This will make it a lot easier for your users to find what they are looking for. It will also eliminate the possibility of a failed search. You should also use a choice box when deleting a card.
Reply
#3
Thanks
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Is there a way to call and focus any popup window outside of the main window app? Valjean 6 1,735 Oct-02-2023, 04:11 PM
Last Post: deanhystad
  How to display <IPython.core.display.HTML object>? pythopen 3 45,899 May-06-2023, 08:14 AM
Last Post: pramod08728
  Pyspark Window: perform sum over a window with specific conditions Shena76 0 1,164 Jun-13-2022, 08:59 AM
Last Post: Shena76
Information Unable to display joystick's value from Python onto display box MelfoyGray 2 2,220 Nov-11-2020, 02:23 AM
Last Post: MelfoyGray
  python display with '\\' when prints with key-value in dictionary maiya 12 9,472 May-30-2020, 05:56 PM
Last Post: maiya
  How To Display this Python Code in Web browser? pradhan 1 3,307 Jul-14-2019, 06:59 PM
Last Post: snippsat
  Escape sequences display in python Uchikago 1 2,416 Jun-27-2019, 03:25 PM
Last Post: Gribouillis
  Convert List of Dictionary to dictionary of dictionary list in python kk230689 2 49,652 Apr-27-2019, 03:13 AM
Last Post: perfringo
  Change the output window size and display area issac_n 0 2,264 Apr-13-2018, 04:41 AM
Last Post: issac_n
  Close IDLE display window? Emerogork 14 8,041 Jan-03-2018, 02:17 AM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020