#!/usr/bin/python
title="Komunikat LinuxCNC"
fontsize = 15
import sys
import os
import ConfigParser
import Tkinter as tk
MessageFilePath = __file__ + "messages.ini"
proceed = "Y"
if not os.path.isfile(MessageFilePath):
instruction = MessageFilePath + "
proceed = "N"
else:
does not exist"
if len(sys.argv) == 1:
instruction = "M100 was called with no P value"
proceed = "N"else:
P=sys.argv[1]
if len(P)<7:
ps=P
else:
ps=P[0:len(P)-7]
cfg = ConfigParser.ConfigParser()
try:
cfg.read(MessageFilePath)
instruction = cfg.get("Messages", ps)
instruction = instruction.decode("unicode_escape")
except (ConfigParser.MissingSectionHeaderError), Argument:
proceed = "N"
instruction = "First line ofn" + MessageFilePath + "nmust be:n[Messages]"
pass
except (ConfigParser.MissingSectionHeaderError, ConfigParser.NoOptionError),
Argument:
proceed = "N"
instruction = "There is no message for numbern" + P + "n in the filen" +
MessageFilePath
if instruction == "":
instruction = "The message for P" + P + " is blank"
proceed = "N"
mess = os.linesep + instruction.replace("n", os.linesep) + os.linesep
window = tk.Tk()
window.title(title)
window.geometry("300x200")
msg = tk.Message(window, text = mess,width=1000)
msg.config(fg="Black", font=("times", fontsize, "bold"))
def close(event):
exit(1)
window.bind("<Escape>",close)
if proceed == "Y":
def go_on(event):
exit(0)
window.bind("<Return>",go_on)
def Continue_clicked():
exit(0)btnContinue =
tk.Button(window,text="Kontynuuj",command=Continue_clicked,width=60,height=1,font=("Helve
tica", "20"))
btnContinue.configure(bg = "gray")
def Stop_clicked():
exit(1)
msg.pack()
if proceed == "Y":
btnContinue.pack()
window.mainloop()