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

  • SEARCH
  • Home
  • 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 8714975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:44:06+00:00 2026-06-13T05:44:06+00:00

url=StringVar() txt1=Entry(root,textvariable=url) txt1.pack() button1 = Button(root, text=Download ,command=downloadFile) button1.pack() root.mainloop() ok this is my

  • 0
url=StringVar()
txt1=Entry(root,textvariable=url)
txt1.pack()

button1 = Button(root, text="Download" ,command=downloadFile)
button1.pack()
root.mainloop()

ok this is my basic GUI… I have a textbox txt1 which i want to use in the function below

def downloadFile():
    #print "url is:",url
    file_name = url.split('/')[-1]

My aim is to feed in the URL in the textbox and then split the URL in my function downloadfile(), but my url variable becomes PY_VAR0 instead of “www.example.com/file.exe”

and the error message I get is “StringVar instance has no attribute split”
I am doing something very wrong but i don’t know where.
Can anyone help please?

  • 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-06-13T05:44:07+00:00Added an answer on June 13, 2026 at 5:44 am

    StringVar is just a “Value holder for strings variables”. To get its content (the string) use:

    StringVar.get() # Return value of variable as string.
    

    printing the StringVar directly (“print url”) invokes:

    StringVar.__str__() # Return the name of the variable in Tcl.
    

    which will return the internal variable name, not its value. in your code use:

    file_name = url.get().split('/')[-1]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

URL is here: http://www.thexsoft.com/DownloadFolder/download.php?file=P2PTransfer This page is basically a way for me to have
URL u=new URL("telnet://route-server.exodus.net"); This line is generating : java.net.MalformedURLException: unknown protocol: telnet And I
url.rewrite-once = ( .*\.(js|ico|gif|jpg|png|css|html)$ => $0, ^/([^?]*)(\?.*)?$ => /$1.php/$2, ) This is what I
I'm trying to output all elements of this json : {nodes:[{url:asdfas,date:},{url:asdfas,date:},{url:asdfasfdasas,date:}]} Here is the
url: /contents/view/chapter:models/section:associations class ContentsController extends AppController { function view() { $this->params['named']; } } For
URL Download http://code.google.com/p/mwiphonesdk/source/browse/#svn/trunk/iMADE/PrepTasks/08 I have code at the location at the link above and
url: /foo/ href={% url foo %} This is my url. I want to send
Please someone Fix this Javascript Code. This script actually reads the URL Parameter and
I have a simple config file that looks a bit like this: [sectionA] url
URL: http://www.tmla.org/athletics/ Tried reuploading the images and no luck. Never encountered this before. Anyone

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.