Python Forum
[Tkinter] how do I enter code into python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] how do I enter code into python
#11
you're trying to run the interpreter from the interpreter
from command line:
python test.py
Reply
#12
>>> - that is the python interpreter, not command prompt
c:\Users\bob> - that is command prompt
so open cmd. cd your working directory to be c:\Users\bob and write python test.py
if done right it will look like this
c:\Users\bob>python test.py
Reply
#13
I have opened a cmd and entered the info as below.
[Image: enhance]
Reply
#14
how did you install python? the error means that python is not added to your PATH
https://python-forum.io/Thread-Basic-Par...er-Windows
Reply
#15
I used the installer that came with it.
I can't find any way of adding the path now, is it possible without unloading and reloading the python software?
I moved the file to the same directory that python is in and made a call in CMD to there this is what I got.
[Image: enhance]

I removed the lines 4,5,6&7 as Gribouillis said earlier and I think it has worked, I now have a box called hello world.
Reply
#16
(Feb-13-2018, 03:01 PM)matelot Wrote: I can't find any way of adding the path now, is it possible without unloading and reloading the python software?
Yes but its more complicated and if you mess it up you can mess up windows calls. I would suggest to reinstall python and tick everything pertaining to PATH. https://www.pythoncentral.io/add-python-...l-command/

I would also change to a custom python install path that is shorter than the default appdata one

Python will always work in its directory as you are directly calling python from that directory.

As for your traceback
  pip install pyserial
But thats not going to work if you dont have python its path var. Pip would be in the scripts folder....but i would first fix your python to be in the PATH instead
Recommended Tutorials:
Reply
#17
You don't need pyserial to run a simple tkinter window. The only useful import here is tkinter.
Reply
#18
I am hoping to run a program that links an arduino to a mechanical device and the information I have is to use python to do it and provides the program that includes pyserial so I need pyserial.
I am just about to delete the python software and try to reinstall it.

I have now reloaded python In fact I found a 64 bit version that I loaded and did a custom load. Ticked the PATH box and saved the files in c;\users\bob\python36.
If I put my test file in python36 and remove the references to pyserial it works fine.
I assumed that ticking the path box would mean that python would run from anywhere, it seems not, if I put my test file (without the pyserial part) in c;\users\bob and try to run it from there I get a box saying
the application was unable to start correctly(0xc000007b)
I was hoping this would help with the fact that the pyserial files are elsewhere.
I am slowly moving forward but still need to be able to run the file that contains
## Rubik (Hello, World)             @ kas 2017

from tkinter import *
import serial, time
from serial import SerialException
import atexit
import subprocess

root =Tk()
root.title('Hello, World')
root.geometry('300x300+200+200')          ## window size + position

root.mainloop()
Any help would be appreciated.
Reply


Forum Jump:

User Panel Messages

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