Jul-05-2017, 08:48 PM
Hi, my code doesn't seem to fully work. The self.ram_current_label and self.ram_maximum_label aren't being displayed. Everything in MapGUI works, along with the self.test_label, and removing MapGUI doesn't fix the issue either. I'm not the sharpest, so there might be a glaring mistake! I'm not receiving any error messages. I've added the entire code because I'm really not sure what's causing this. Thanks.
""" NeuralCrack Main GUI To be imported into the base engine """ from tkinter import * import os # Gets the base neuralcrack path and the resources path path_base = os.getcwd().replace("\\engines", "\\") path_resources = path_base + "resources\\" class MapGUI: def __init__(self, master): # The map def map_resize_inc(): map_image = PhotoImage(file=map_path).zoom(1, 1) self.map_button.config(image=map_image, command=map_resize_dec) self.map_button.map_image = map_image self.map_button.update() def map_resize_dec(): map_image = PhotoImage(file=map_path).subsample(3, 3) self.map_button.config(image=map_image, command=map_resize_inc) self.map_button.map_image = map_image self.map_button.update() map_path = path_resources + "map_temp.png" map_image = PhotoImage(file=map_path).subsample(3, 3) self.map_button = Button(master, image=map_image, command=map_resize_inc) self.map_button.map_image = map_image self.map_button.grid(row=1,column=1) class RAMCounterGUI: def __init__(self, master): # The RAM Bar self.ram_maximum = 3200 self.ram_current = 100 self.ram_maximum_label = Label(master, text="a", borderwidth=1, highlightcolor="black", width=self.ram_maximum, height=20) self.ram_current_label = Label(master, fg="red", width=self.ram_current, height=10) self.test_label = Label(master, text="Test") self.test_label.grid() self.ram_maximum_label.grid(column=2) self.ram_current_label.grid(column=2) root = Tk() root.geometry("1920x1080") map_gui_initialize = MapGUI(root) ram_gui_initialize = RAMCounterGUI(root) root.mainloop()