Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 python turtle module in pycharm error
#1
hi guys  

import turtle
def draw_star(size,color):
    count = 0
    angle = 144
    sum1 = 0
   # turtle.bgcolor='black'
    turtle.bgcolor = 'black'
    turtle.pen='yellow'
    while count <= 5:
        for i in (1,5):
            sum1=sum1+45
            if count<5:
                turtle.forward(sum1)
                turtle.right(angle)
            if count>5:
                turtle.forward (-size)
                turtle.right (angle)
        count += 1
    return

draw_star(200,"blue")
This code run in python idle without error. but pycharms cant run this code  Think    

pycharm error:

Traceback (most recent call last):
  File "C:/Users/3DVFX/PycharmProjects/untitled4/turtle.py", line 1, in <module>
    import turtle
  File "C:\Users\3DVFX\PycharmProjects\untitled4\turtle.py", line 21, in <module>
    draw_star(200,"blue")
  File "C:\Users\3DVFX\PycharmProjects\untitled4\turtle.py", line 13, in draw_star
    turtle.forward(sum1)
AttributeError: module 'turtle' has no attribute 'forward'
Quote
#2
Rename turtle.py.
Name is used in bye python to run the module eg ‪C:\Python35\Lib\turtle.py
nilamo, micseydel, sajley like this post
Quote
#3
(Dec-12-2016, 08:14 PM)snippsat Wrote: Rename turtle.py.
Name is used in bye python to run the module eg ‪C:\Python35\Lib\turtle.py

i rename turtle.py to myturtle.py    Tongue Clap

Thankyou
nilamo likes this post
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Error in importing package in pycharm fullstop 0 56 Dec-12-2019, 04:03 PM
Last Post: fullstop
  setup() from turtle module not working bobfat 7 226 Oct-28-2019, 11:05 AM
Last Post: newbieAuggie2019
  can't assign to literal error in pycharm ryder5227 2 162 Oct-07-2019, 08:57 PM
Last Post: Bmart6969
  Pycharm Cannot Find Pygame Module Myang123 2 605 Aug-07-2019, 01:26 AM
Last Post: Myang123
  uising python zero with IDLE I get an error of 'module not found' Brian123 1 557 Apr-24-2019, 09:21 PM
Last Post: Yoriz
  Python Turtle and order of implementation query Parsleigh 2 420 Mar-04-2019, 02:43 PM
Last Post: Parsleigh
  Module which run in PyCharm but not as exe or terminal. diegoctn 2 654 Feb-13-2019, 11:12 AM
Last Post: diegoctn
  wn = turtle.screen() AttributeError: module 'turtle' has no attribute 'screen' Shadower 1 1,347 Feb-06-2019, 01:25 AM
Last Post: woooee
  Help! Turtle not working, even when we click the turtle demo in IDLE nothing happens. BertyBee 3 620 Jan-04-2019, 02:44 AM
Last Post: SheeppOSU
  Cant run command python in PyCharm, but it works in cmd LevG0r 1 625 Sep-09-2018, 06:21 PM
Last Post: Axel_Erfurt

Forum Jump:


Users browsing this thread: 1 Guest(s)