Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to open Python?
#38
(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 Dance .

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()
Reply


Messages In This Thread
How to open Python? - by bensan - Jun-05-2021, 02:36 PM
RE: How to open Python? - by Axel_Erfurt - Jun-05-2021, 04:04 PM
RE: How to open Python? - by bensan - Jun-06-2021, 09:18 PM
RE: How to open Python? - by Larz60+ - Jun-07-2021, 12:25 AM
RE: How to open Python? - by bensan - Jun-09-2021, 04:06 PM
RE: How to open Python? - by Gribouillis - Jun-09-2021, 04:23 PM
RE: How to open Python? - by Larz60+ - Jun-09-2021, 09:29 PM
RE: How to open Python? - by perfringo - Jun-10-2021, 08:20 PM
RE: How to open Python? - by bensan - Jun-17-2021, 04:36 PM
RE: How to open Python? - by perfringo - Jun-18-2021, 09:55 AM
RE: How to open Python? - by bensan - Jun-18-2021, 07:08 PM
RE: How to open Python? - by bensan - Jun-17-2021, 08:47 PM
RE: How to open Python? - by Larz60+ - Jun-18-2021, 08:14 PM
RE: How to open Python? - by bensan - Jun-18-2021, 09:32 PM
RE: How to open Python? - by snippsat - Jun-18-2021, 09:29 PM
RE: How to open Python? - by bensan - Jun-23-2021, 01:22 PM
RE: How to open Python? - by snippsat - Jun-23-2021, 02:23 PM
RE: How to open Python? - by bensan - Jun-23-2021, 07:34 PM
RE: How to open Python? - by jefsummers - Jun-23-2021, 05:01 PM
RE: How to open Python? - by snippsat - Jun-23-2021, 05:29 PM
RE: How to open Python? - by snippsat - Jun-23-2021, 07:50 PM
RE: How to open Python? - by bensan - Jun-23-2021, 08:33 PM
RE: How to open Python? - by snippsat - Jun-23-2021, 09:11 PM
RE: How to open Python? - by bensan - Jun-24-2021, 08:25 AM
RE: How to open Python? - by jefsummers - Jun-24-2021, 01:59 AM
RE: How to open Python? - by bensan - Jun-24-2021, 08:32 AM
RE: How to open Python? - by Larz60+ - Jun-24-2021, 10:11 AM
RE: How to open Python? - by snippsat - Jun-24-2021, 10:53 AM
RE: How to open Python? - by bensan - Jun-25-2021, 01:55 PM
RE: How to open Python? - by jefsummers - Jun-24-2021, 06:24 PM
RE: How to open Python? - by buran - Jun-24-2021, 08:58 PM
RE: How to open Python? - by Yoriz - Jun-24-2021, 10:04 PM
RE: How to open Python? - by bensan - Jun-25-2021, 01:15 PM
RE: How to open Python? - by deanhystad - Jun-25-2021, 01:30 PM
RE: How to open Python? - by bensan - Jun-25-2021, 03:07 PM
RE: How to open Python? - by Yoriz - Jun-25-2021, 03:20 PM
RE: How to open Python? - by bensan - Jun-25-2021, 03:50 PM
RE: How to open Python? - by Gribouillis - Jun-25-2021, 02:53 PM
RE: How to open Python? - by Yoriz - Jun-25-2021, 04:09 PM
RE: How to open Python? - by bensan - Jun-25-2021, 04:56 PM
RE: How to open Python? - by Yoriz - Jun-25-2021, 05:12 PM
RE: How to open Python? - by bensan - Jun-26-2021, 04:46 PM
RE: How to open Python? - by Yoriz - Jun-26-2021, 05:12 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020