コード例 #1
0
def messageWindow(x2,window):
    #Top Level is used to display the window at the very front in case there is already a seperate window open as reference
    win = Toplevel()
    #To restrict window geometrical size
    win.resizable(width=False, height=False)
    #To remove the unnecessary Tk() window
    win.iconify()

    win.title("Decoded Text")
    #Hex code for dark blue
    win.configure(background="#192a3d")
    Label(win, text="Decoded Text:\n", bg="#192a3d", fg="white", font=("MarvelScript", 12, "bold")).grid(row=1,
                                                                                                   column=0,
                                                                                                   sticky="N")
    Label(win, text=x2, bg="black", fg="white", font=("Sitka", 12, "bold"),wraplength=1600 ).grid(row=2,
                                                                             column=0,
                                                                             sticky="N")
    Button(win, text="Exit", width=4, command=lambda: win.destroy()).grid(row=3, column=0, sticky="E")
コード例 #2
0
window = Toplevel(root)
window.title('New Window')

# to put window under main
window.lower()
window.lift(root)

# we can control windows state
window.attributes('-zoomed', True)  # maximized
window.state('withdrawn')  # not visible
window.state('iconic')  # minimized
window.state('normal')  # back to normal (before withdrawn)
window.state()

# minimize, maximize
window.iconify()
window.deiconify()

# move and resize window
# from top-left corner
window.geometry('640x480+50+100')  # widthxheight+x+y

# make window resizable
window.resizable(False, False)

# set max and min size of window
window.maxsize(640, 480)
window.minsize(200, 200)
window.resizable(True, True)

# to destroy root window with all childs and widgets