Python Forum
Thread Rating:
  • 2 Vote(s) - 1.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Graphics py not found
#11
I hard to say when  you don't tell what you do.
Here is a test you can do:
# bar.py
print('Hello world')
bar.py just place in my C:\python36 folder.
Now i can import it:
Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. Med enerett.
C:\Windows\System32>cd\
C:\>python
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 07:18:10) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import bar
Hello world
>>>
So you see there is no magic,if you place a python file in a folder of sys.path list you can import it.

If i download graphics.py and just place it same place bar.py it work.
C:\>python
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 07:18:10) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from graphics import*
>>> GraphWin.tk_bisque
<function Misc.tk_bisque at 0x018DA9C0>
Reply
#12
Thanks a lot for your help
That worked i'm running now ...the problem was that i named the file 'graphics.py' as opposed to just 'graphics'. The instructions i found on youtube specifically stated that the file had to have a .py extension.
Reply
#13
(Apr-05-2017, 03:48 PM)vnc Wrote: That worked i'm running now ...the problem was that i named the file 'graphics.py' as opposed to just 'graphics'.
Is the other way a around the file should be named graphics.py and placed somewhere in sys.path
When you import it there is no .py extension.
So when import:
>>> import graphics
>>> # Or
>>> from graphics import *
But if you have it working it's all good.
Not to happy with graphics.py teaching method just to mention that Undecided
Reply
#14
Hm!  Smile
Did you look at the link I posted for you: https://docs.python.org/3/tutorial/modules.html#modules
At the top of the page, 3-th paragraph.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python graphics kaltenherz 1 1,718 Sep-05-2021, 05:19 PM
Last Post: jefsummers
  How can I found how many numbers are there in a Collatz Sequence that I found? cananb 2 2,540 Nov-23-2020, 05:15 PM
Last Post: cananb
  from graphics import * jmaloney413 2 5,213 Oct-18-2018, 08:22 AM
Last Post: perfringo

Forum Jump:

User Panel Messages

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