-1

I'm new to GUI programming and im trying to make my first GUI program, However. For some reason nothing will show on the frame. The frame is successfuly made, yet i cant show any image on it. I've also tried making a button with no further success. Sorry if this is something obvious, but like i earlier said i do not have any experiance with gui programming in python.

from tkinter import *  # Import the tkinter module (For the Graphical User Interface)
from PIL import ImageTk, Image

width = 1920
height = 1080
RootGeo = str(width) + "x" + str(height)  # Make a def for RootGeo so the Root geometry isn't hardcoded


def MakeWindow():
    # -----Root_Attributes-----

    Root = Tk()
    Root.geometry(RootGeo)
    Root.state("zoomed")

    # -----Root_Attributes, Root_Containers----- ### NOT WORKING ###
    __DISPLAY_DIRECTORY__ = "C:\Users\Gotta\PythonProjects\AutoCam\Settings.gif"
    __DISPlAY__ = Image.open(__DISPLAY_DIRECTORY__).resize((50, 50))
    __DISPLAY_RENDER__ = ImageTk.PhotoImage(__DISPlAY__)

    Display_icon = Label(Root, image=__DISPLAY_RENDER__)
    Display_icon.pack()
    # -----Root_Containers----- ### NOT WORKING ###

    Root.mainloop()


MakeWindow()

1 Answers1

0

As it turns out, pycharm does not want to show images in a tkinter frame. The solution was then to save the Pycharm file and then run the script from cmd.