Whenever I try to run a simple tkinter program - or any program for that mater - using tk.mainloop() on ubuntu 16.04.2, I cannot open the app window and a question mark is shown over the window icon.
Here the the program I am running:
import tkinter as tk
class MainApplication(tk.Frame):
    def __init__(self, parent, *args, **kwargs):
        super(MainApplication, self).__init__(parent, *args, **kwargs)
if __name__ == '__main__':
    root = tk.Tk()
    MainApplication(root).pack(side="top", fill="both", expand=True)
    root.mainloop()
And here is a screen shot showing the output of the program whenever I run the it:
Before this, I was receiving an error saying _tkinter could be loaded. To remedy this, I downloaded the latest version of tkinter for ubuntu by using sudo apt-get update and then sudo apt-get install python3-tk. If this also matters, I'm using ubuntu in a dual-boot configuration with windows 10.
I've also read How can I fix program icons that appear as a question mark in the Launcher? and Why do some open applications appear as “question marks” in the Unity launcher?, but those question seemed to be dealing with how to fix a applications desktop icon, not how to fix an application that wouldn't run. Further more, the question seemed to be dealing with specific ubuntu applications.
Does anyone know why ubuntu is not correctly running the tkinter app and what can be done to fix this?

 
     
    


