473,569 Members | 2,901 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Tkinter function variable passing

How to pass the variables defined inside the function to the another
function on click event of the button in Tkinter?
pleas send me a sample code if anybody has it.
thanx

Jul 3 '06 #1
4 2467
arvind wrote:
How to pass the variables defined inside the function to the another
function on click event of the button in Tkinter?
def the_function(ma ster):

variable = ...

def callback():
print variable

b = Button(master, command=callbac k)

</F>

Jul 3 '06 #2
Hi
thanx for replynig.
but functios are independent
and the button is inside one of the functions.
will u please reshape ur code and send it to me?
thank u.
Fredrik Lundh wrote:
arvind wrote:
How to pass the variables defined inside the function to the another
function on click event of the button in Tkinter?

def the_function(ma ster):

variable = ...

def callback():
print variable

b = Button(master, command=callbac k)

</F>
Jul 3 '06 #3
"arvind" <ar**********@g mail.comwrote:
thanx for replynig.
but functios are independent
and the button is inside one of the functions.
will u please reshape ur code and send it to me?
where do I send the invoice ?

</F>

Jul 3 '06 #4
please send it to- ar**********@gm ail.com.
Fredrik Lundh wrote:
"arvind" <ar**********@g mail.comwrote:
thanx for replynig.
but functios are independent
and the button is inside one of the functions.
will u please reshape ur code and send it to me?

where do I send the invoice ?

</F>
Jul 4 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4059
by: Rob Andrews | last post by:
I'm on a Red Hat 9 system, which has Python 2.2.2 installed, and I installed 2.3 separately into /home/rob/Python-2.3/ (creating the symbolic link "py23" to point to my 2.3 installation). Now I'm trying to work out the kinks in the process. Unable to run Idle using 2.3 the way I've got things set up, I created a super simple Tkinter test...
2
3996
by: mksql | last post by:
New to Tkinter. Initially, I had some code that was executing button commands at creation, rather than waiting for user action. Some research here gave me a solution, but I am not sure why the extra step is necessary. This causes the "graph" function to execute when the button is created: Button(root, text='OK', command=graph(canvas))) ...
2
4698
by: Marc | last post by:
Hi all, I was using Tkinter.IntVar() to store values from a large list of parts that I pulled from a list. This is the code to initialize the instances: def initVariables(self): self.e = IntVar() for part, list in info.masterList.items():
4
1270
by: Tim Daneliuk | last post by:
I am trying to initialize a menu in the following manner: for entry in : func = entry UI.ShortBtn.menu.add_command(label=entry, command=lambda: func(None)) However, at runtime, each of the menu options binds to the *last* function named in the list (KeyStartDir).
5
2043
by: max(01)* | last post by:
hello. the following code: 1 from Tkinter import * 2 3 class MiaApp: 4 def __init__(self, genitore): 5 self.mioGenitore = genitore 6 self.i = IntVar()
11
7851
by: William Gill | last post by:
I am placing radiobuttons in a 4 X 4 matrix (using loops) and keep references to them in a 2 dimensional list ( rBtns ). It works fine, and I can even make it so only one button per column can be selected, by assigning each column to an intVar. In many languages a radiobutton has a property that can be directly read to see if it is selected...
5
3521
by: H J van Rooyen | last post by:
Hi, I am struggling to get the pack method to do what I intend. I am trying to display user input in a seperate window, along with a little description of the field, something like this: Current entry Company : entered co. name First entry : entered stuff The second entry: more entered stuff
2
4102
by: Kevin Walzer | last post by:
I'm trying to construct a simple Tkinter GUI and I'm having trouble with getting the value of an entry widget and passing it onto a callback function. But I'm not grokking variable scope correctly. I have two functions. Here are the relevant excerpts: def makeGUI(): ###lots of code to set up toplevel windows
0
1529
by: wolfonenet | last post by:
Hi All, My setup is: WinXP Python 2.5.1 TKinter version: $Revision: 50704 $ Tcl: 8.4 Debugger: WinPdb
0
7693
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7665
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7962
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6277
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.