Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4015804
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:39:48+00:00 2026-05-20T09:39:48+00:00

So I’m learning python, and I seem to be having a consistent problem with

  • 0

So I’m learning python, and I seem to be having a consistent problem with calling setText() methods on Text objects. The process works fine when I’m in the interactive IDLE GUI, but when I save modules and then try to run them, I get:

nonetype object has no attribute setText

Do I need to assign some sort of return type to the text assignment? Why would there be different behavior from IDLE to saved modules? I’ve searched the site and Python documentation and was unable to turn up anything. Any help would be much appreciated.

message1 = Text(Point(50,50), "Click).draw(win)
message1.setText("")

Edited to add…

Thanks Geo, your suggestion fixed things.

Now my question is, what’s the difference between…

message = Text(Point(50,50), "Click").draw(win)

… and …

message = Text(Point(50,50), "Click")
message.draw(win)

… with regards to returning something, or ensuring that the message object has a type that supports certain functions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T09:39:49+00:00Added an answer on May 20, 2026 at 9:39 am

    I’m not sure how to answer your second question properly..so I’ll just do it as an answer here.

    The reason the first does not work is because you are assigning the return value of Text.draw to message. Since it returns nothing, then message is None.

    In the working code, you assign message with the type Text and initialize the object. You then call the draw method of this object, and the setText method.

    In the non-working code, you are calling the draw method on a new Text object, then assigning the return of that – that is, NoneType – to message. And since None has no setText method, you get an error.

    (Sorry if I have mixed up NoneType and None there)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.