|
Because they're trying to save an extra line. Both the object specific "value" (self.value) and the global variable "value" are affected, and set to "self.value + 1".
|
# ¿ Feb 10, 2008 19:07 |
|
|
# ¿ May 4, 2024 08:05 |
|
epswing posted:Ok so maybe I'm going blind but I don't see any global variables. I see two class definitions, a counter object and a for loop. See that variable called "value"? That's global: the very same one is used in both classes. Python can be confusing that way, since the variable doesn't need to be declared to be global in a special way.
|
# ¿ Feb 10, 2008 20:51 |
|
urmomlolzinbed posted:Here's a quick question. I'm trying to create a gui in python that has a tree view widget (see JTree which is part of Java's swing library). The only experience I have with python and guis are just some quick ones that I've made using basic Tkinter widgets. Does Tkinter have a tree view similar to what I'm asking for or should I used another module? Also, do you guys have any good python gui books or resources you can recommend? My recommendation, due to me not knowing Tkinter at all, is to simply use Glade to build a GUI (if this is in a Linux environment, you didn't say). Glade spits out an XML file, and like two lines of Python reads that XML file and gives you your GUI. All events that you want to handle are set in the XML file, so you just need to write Python functions for dealing with them.
|
# ¿ May 23, 2008 10:48 |