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 7749945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:09:48+00:00 2026-06-01T11:09:48+00:00

hi i have function which is called by tinker listbox so i cannot return

  • 0

hi i have function which is called by tinker listbox
so i cannot return the value from it
basically i have a global object and i want to assign it inside a function
how can i do it

    rlink = ('http://stackoverflow', 'pastbin.com', 'unix.com')
    clink  = ' '
    # the function
    def listbinding(*args):
        idxs = reslinkbox.curselection()
        idx = int(idxs[0])

        clink = rlink[idx]

i want to rlink[idx] to assign to clink which is a global object
i cannot call the function, tkinter listbox calls the function so i cannot return clink from it

  • 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-01T11:09:49+00:00Added an answer on June 1, 2026 at 11:09 am

    Use the global keyword.

     rlink = ('http://stackoverflow', 'pastbin.com', 'unix.com')
     clink  = ' '
     def listbinding(*args):
         global clink
         idxs = reslinkbox.curselection()
         idx = int(idxs[0])
    
         clink = rlink[idx]
    

    <obligitory>Using globals like that is more often than not a bad idea as it smears your programs state all over the module rather than having it broken down into nice, discrete chunks. Preventing this is the whole purpose of name spaces. Many computer scientists have spent many years of hard, thankless work to bring you this knowledge.</obligitory>

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

Sidebar

Related Questions

I have a function which calculates distance from database records. This function is called
I have a Function in CFC file, which will be called from .cfm file
I have a recursive function fact , which can be called from either an
I have a function which returns an int value for a given key (from
so I have this function which gets called multiple times during my program. //global
I have following function which is called continuously from run() of a Thread which
I have this function which is called about 1000 times from main(). When i
I have a function, which is called sometimes with regular, sometimes dynamic arrays. If
I have a function: def create(sender, **kw): [...] Which should be called when the
I have this code which is called at an onChange event of an function

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.