FelixDieKatze
Posts: 4
Joined: Sun Dec 31, 2017 12:17 pm

Button Command stops GUI developing

Wed Jan 03, 2018 5:13 pm

I have a simple GUI that builds Ok. all good to this point. But as soon as i Give Button 1 a Command to open a file the GUI frame opens but no other buttons. Can anyone help. Very new to programming and stumped at the mo. I have highlighted the code that I added that is causing the issue

# Build a GUI

from Tkinter import *

# Main Frame

class Window (Frame) :
def __init__ (self, master = None):
Frame.__init__(self, master)

self.master = master

self.init_window ()

def init_window(self):

self.master.title ("ESS MS Control Console 4 Inlet")

self.pack(fill=BOTH, expand=1)

def openFile(self):
os.startfile("Inlet1open.py")


# Button creation

inlet1button = Button (self, command = openFile, text="Inlet 1" , height = 2, width = 6)

inlet1button.place (x=20, y=50)

inlet2button = Button (self, text="Inlet 2" , height = 2, width = 6)

inlet2button.place (x=20, y=100)

inlet3button = Button (self, text="Inlet 3" , height = 2, width = 6)

inlet3button.place (x=20, y=150)

inlet4button = Button (self, text="Inlet 4" , height = 2, width = 6)

inlet4button.place (x=20, y=200)

heater1button = Button (self, text="Inlet 1 Heater" , height = 2, width = 10)

heater1button.place (x=120, y=50)

heater2button = Button (self, text="Inlet 2 Heater" , height = 2, width = 10)

heater2button.place (x=120, y=100)

bakebutton = Button (self, text="Bake Jacket" , height = 2, width = 10)

bakebutton.place (x=120, y=150)

loopbutton = Button (self, text="Loop all Inlets" , height = 2, width = 10)

loopbutton.place (x=20, y=250)




# Size of Window

root = Tk()

root.geometry("400x400")

app = Window(root)

root.mainloop()

Return to “General discussion”

Who is online

Users browsing this forum: Bing [Bot] and 62 guests