Пример для работы с tkinter

Тут все основные действия, для написания GUI приложения под линукс с Python3 tkinter.

import tkinter as tkcore
import tkinter.messagebox
from tkinter import Tk, Menu as TKMenu, Frame as TKFrame, Button as TKButton
 
 
class Application(TKFrame):
 
    buttons = {}
 
    def __init__(self, window):
        super().__init__(window)
        self.window = window
        window.title("Ship Engine Unit")
        self.createMenu()
        width, height = 640, 480
        screenwidth = window.winfo_screenwidth()
        screenheight = window.winfo_screenheight()
        alignstr = '%dx%d+%d+%d' % (width, height, (screenwidth - width) / 2, (screenheight - height) / 2)
        window.geometry(alignstr)
        window.resizable(width=False, height=False)
        self.pack()
        self.create_widgets()
 
    def createMenu(self):
        menu = TKMenu(window)
        subMenu = TKMenu(menu)
        menu.add_cascade(label="File", menu=subMenu)
        subMenu.add_command(label="New Project", command=self.on_menu_NewProject_click)
        subMenu.add_separator()
        subMenu.add_command(label="He he", command=self.on_menu_NewProject_click)
        editMenu = TKMenu(menu)
        menu.add_cascade(label="Edit", menu=editMenu)
        editMenu.add_command(label="Undo", command=self.on_menu_NewProject_click)
        self.window.config(menu=menu)
 
 
    def create_widgets(self):
        toolbar = TKFrame(master=self.window, bg="#007000")
        self.buttons["hello"] = TKButton(master=toolbar)
        self.buttons["hello"]["text"] = "Hello world!"
        self.buttons["hello"]["command"] = self.on_hello_click
        #self.buttons["hello"]["font"] = ("ubuntu", 60, "bold")
        self.buttons["hello"].pack(side="left", padx=2, pady=2)
        self.buttons["quit"] = TKButton(master=toolbar, text="Quit",
            fg="red", command=self.window.destroy)
        self.buttons["quit"].pack(side="right", padx=2, pady=2)
        toolbar.pack(side=tkcore.TOP, fill=tkcore.X)
 
        # bd=border 2px ,, relief=рельеф втянутый ,, anchor= текст алигминтироать по WEST
        status = tkcore.Label(master=self.window, bg="#000070", fg="white", bd=2, relief=tkcore.SUNKEN,
                              text="Загрузка чего-то полезного...", anchor=tkcore.W)
        status.pack(side="bottom", fill=tkcore.X)
 
        canvas1 = tkcore.Canvas(self.window, width=300, height=300)
        canvas1.pack(side=tkcore.TOP, fill=tkcore.BOTH)
        blackLine = canvas1.create_line(0, 10, 200, 50) # x1,y1,x2,y2
        redLine = canvas1.create_line(0, 0, 50, 50, fill="red")
        greenBox = canvas1.create_rectangle(25, 25, 130, 60, fill="green")
        canvas1.delete(redLine)
        # canvas1.delete(tkcore.ALL)   # clear canvas
 
        filename = "photo1.png"
        photo = tkcore.PhotoImage(master=self.window, file=filename)
        label = tkcore.Label(self.window, image=photo)
        label.place(x=250, y=250, width=100, height=100)
 
        # Ввод Текста
        GLineEdit_757 = tkcore.Entry(master=self.window)
        GLineEdit_757["borderwidth"] = "1px"
        #ft = tkFont.Font(family='Times', size=10)
        # GLineEdit_757["font"] = ft
        GLineEdit_757["fg"] = "#333333"
        GLineEdit_757["justify"] = "center"
        GLineEdit_757["text"] = "Entry"
        GLineEdit_757.place(x=90, y=100, width=248, height=30)
 
        # ввод текста + Watch
        def callback(strval):
            print(strval.get())
        sv = tkcore.StringVar(value="Editing is watched")
        sv.trace("w", lambda name, index, mode, sv=sv: callback(sv))
        e = tkcore.Entry(self.window, textvariable=sv)
        e.pack()
 
        # Ввод только цифр (см. this.callback2)
        vcmd = (self.register(self.callback2))
        w = tkcore.Entry(self.window, validate='all', validatecommand=(vcmd, '%P'))
        w.pack()
 
    @staticmethod
    def callback2(P):
        if str.isdigit(P) or P == "":
            return True
        else:
            return False
 
 
    @staticmethod
    def on_menu_NewProject_click():
        answer = tkinter.messagebox.askquestion(title="NewProject!", message="You are welcome to Create New Project\n\nContinue?")
        if answer == tkinter.messagebox.YES:
            tkinter.messagebox.showinfo(title="NewProject! message 2", message="Project created!")
 
    @staticmethod
    def on_hello_click():
        print("Hello world!")
 
 
# program Boot code
window = Tk()
Application(window=window)
window.mainloop()