User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Python section within the Software Development category of DaniWeb, a massive community of 397,653 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,396 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Python advertiser:

Python GUI Problem

Join Date: Jul 2006
Posts: 562
Reputation: jrcagle is on a distinguished road 
Rep Power: 4
Solved Threads: 72
jrcagle jrcagle is offline Offline
Posting Pro

Re: Python GUI Problem

  #4  
Aug 18th, 2007
Originally Posted by jrcagle
  1. root.input_text = Text(root, ...) # rest of options go in ...
  2.  
  3.  
Now, Python will make input_text a data member of root, which is what you wanted anyways.

Originally Posted by Haze View Post
Would this not mean that your just changing the variable to root.input.text should it not be like this

  1. input_text = root.Text(root, ...) # rest of options go in


Well, here's what the first one means:

* Create a Text widget.
* Assign the return value (the Text widget object itself) to the variable root.input_text.

So yes, it does change the value of root.input_text, by setting it equal to the Text widget. Previously, root.input_text did not exist, so that's not a problem; you haven't clobbered anything.

Here's what the second one means:

* call the function root.Text() (which doesn't exist, since Tk objects don't a function called Text())
* Assign the return value to the local variable input_text.

You don't want that, since input_text will go out of scope when your function ends, and then you lose ability to access it.

I hope that's clear...

Originally Posted by Hazel
The command part was intended to mean that when the button was selected it would disable the input_text widget. Should i create a function that does this then put that as the command?


Ah... yes, you should create a new function and supply the name of that function as the command.

Jeff
Last edited by jrcagle : Aug 18th, 2007 at 2:57 pm.
Reply With Quote  
All times are GMT -4. The time now is 11:27 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC