Jun-25-2021, 03:50 PM
(Jun-25-2021, 03:20 PM)Yoriz Wrote:(Jun-25-2021, 03:07 PM)bensan Wrote: the script @Yoriz provided it brings up a command window with another box that has a print button. Whatever I write into that box it only prints.
The box that has the print button is the tkinter window that is created by the python code that I posted, you have confirmed that it works for you congrats .
Thanks @Yoriz. OK, how do I get the following to open a program window? I dont want anymore command prompt windows.
import sys v=sys.version() if "2.7" in v: from Tkinter import * import tkFileDialog elif "3.3" in v or "3.4" in v: from tkinter import * import tkinter.tkFileDialog root=Tk("Text Editor") text=Text(root) text.grid() def saveas(): global text t = text.get("1.0", "end-1c") savelocation=tkFileDialog.asksaveasfilename() file1=open(savelocation, "w+") file1.write(t) file1.close() button=Button(root, text="Save", command=saveas) button.grid() def FontHelvetica(): global text text.config(font="Helvetica") def FontCourier(): global text text.config(font="Courier") font=Menubutton(root, text="Font") font.grid() font.menu=Menu(font, tearoff=0) font["menu"]=font.menu Helvetica=IntVar() arial=IntVar() times=IntVar() Courier=IntVar() font.menu.add_checkbutton(label="Courier", variable=Courier, command=FontCourier) font.menu.add_checkbutton(label="Helvetica", variable=helvetica, command=FontHelvetica) root.mainloop()