Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I am using tKinter and Python. I need the output to just print the result string in a normal way onto the actual GUI. As
I am using tKinter and Python.
I need the output to just print the result string in a normal way onto the actual GUI. As you can see below, it prints the result to the GUI in literal string format:
But I just want to to say "California has a population of 7164228 for the year selected". I am not sure if there is another way to do it or not. The last two lines of the if statement are where the print statement to the console, and to the GUI come into play.
for i in range(len(stateNameCol)): if stateName_info == stateNameCol[i]: print(stateName_info, 'has a population of', year[i], 'for the year selected') #stateName_info and year are variables for the state name and year pulled from an excel sheet with all 50 states and their populations printIt = (stateName_info, 'has a population of', year[i], 'for the year selected') ttk.Label(mainframe, text= str(printIt)).grid(column=4, row=9, sticky=W)('California', 'has a population of', 7164228, 'for the year selected') 28 print(selected_state, selected_year)# StateName_into) 29 30 Leapliest.py Le popgen.py excelTest.py External Libraries Scratches and Consoles 1-D-D 31 32 33 for i in range(len(stateNameCol)): if stateName_info stateNameCol[i]: print(stateName_info, 'has a population of', year[i], 'for the year selected') printIt = (stateName_info, 'has a population of', year[i], 'for the year selected') ttk.Label(mainframe, text= str(printIt)).grid(column=4, row=9, sticky=W) 34 A 35 36 except Exception as e: ttk.Label(mainframe, text=str(e)).grid(column=4, row=9, sticky=W) 37 38 39 Population Generator Enter State Name: California oogle.com/settings/security/lesssecureapps") Enter Year: 2002 Search Population ('California', 'has a population of', 7164228, 'for the year selected') pulationGenerator/xcelTest.py the year is 2002 California has a population of 7164228 for the year selected IRI
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started