I don't know why but in each places where strings should be displayed I have PY_VAR# instead (# being a number). For instance instead of displaying "This area shows messages coming from the slave" it displays PY_VAR1. my code is
#!/usr/bin/python
# -*- coding: utf-8 -*-
import tkinter
class Display(tkinter.Tk):
def __init__(self,parent):
tkinter.Tk.__init__(self,parent)
self.parent = parent
self.initialize()
def initialize(self):
self.grid()
self.MessageString = tkinter.StringVar()
MessageDisplay = tkinter.Label(self, text = self.MessageString, anchor = 'nw' , justify = 'left')
MessageDisplay.grid(columnspan = 3)
self.ClockString = tkinter.StringVar()
ClockDisplay = tkinter.Label(self, text = self.ClockString)
ClockDisplay.grid(row=0)
self.Menu1Title = tkinter.StringVar()
Menu1Button = tkinter.Button(self, text = self.Menu1Title, command = self.SetMenu(MenuIndex = 1))
Menu1Button.grid(column = 0, columnspan = 2)
self.Menu2Title = tkinter.StringVar()
Menu2Button = tkinter.Button(self, text = self.Menu2Title, command = self.SetMenu(MenuIndex = 2))
Menu2Button.grid(column = 0, columnspan = 2)
self.Menu3Title = tkinter.StringVar()
Menu3Button = tkinter.Button(self, text = self.Menu3Title, command = self.SetMenu(MenuIndex = 3))
Menu3Button.grid(column = 0, columnspan = 2)
self.MenuDescriptionContent = tkinter.StringVar()
MenuDescription = tkinter.Label(self, text = self.MenuDescriptionContent, anchor = 'nw', justify = 'left')
MenuDescription.grid(column = 2, columnspan = 2, row = 1, rowspan = 3)
"""Temporary variables"""
self.MessageString = "This area shows messages coming from the slave"
self.ClockString = "00:00"
self.Menu1Title = "Menu 1"
self.Menu2Title = "Menu 2"
self.Menu3Title = "Menu 3"
self.MenuDescriptionContent = "This area shows the description of the selected menu"
def SetMenu(self, MenuIndex):
pass
if __name__ == "__main__":
app = Display(None)
app.title('Web Bell')
app.mainloop()
I don't have any error displayed in the console. thank you in advance for your responses