ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
OK, I found an interesting screencast online about how to make gtk Pyton apps. The thing is, though, the guy was using the interactive shell. I've been trying to get his code into a script, and have been having troubles.
It spits out the error "NameError: global name 'browser' is not defined"
I know I'm doing something wrong with how I'm telling it where to find "browser" and "text", but I can't figure out how to point it to the right place.
Anyone know how to fix this? Feel free to point out other ways to improve it.
Thanks! I'm still learn this stuff, I know I'm a noob. This will help me a lot in the future!
I tried the "self.browser.open", but didn't think that I'd have to use self when I first declared them.
Is "self" just a shortcut to it's own class? So self.something instead of It'sOwnClass.something? I've been thinking that so far, so correct me if I'm wrong.
Is "self" just a shortcut to it's own class? So self.something instead of It'sOwnClass.something? I've been thinking that so far, so correct me if I'm wrong.
It's a shortcut to the current instance of the class, not the class itself. There is always exactly one class, but there can be zero or more instances of it.
And "self" is not really a "shortcut", it is the instance. Almost all object-oriented languages work this way (by having the methods belong to the class, and passing the instance as the first parameter), but most of them hide this.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.