Glade3 Gtk Python Tutorial Errors

More
11 Feb 2014 06:02 - 14 Feb 2014 08:52 #43727 by rggrieger
Glade Tutorial

I redid 6a and it seems to be OK.

I copied 6b into glade6.py. Terminal python glade6.py and received the following error:

bob@probotix-desktop:~$ cd glade_tutorial
bob@probotix-desktop:~/glade_tutorial$ chmod +x glade6.py
bob@probotix-desktop:~/glade_tutorial$ python glade6.py
ComboBox Active Text is Select an Item:
ComboBox Active Index is 0
Traceback (most recent call last):
File "glade6.py", line 55, in <module>
main = Buglump()
File "glade6.py", line 40, in __init__
self.window.show() <<<<<<<<<<< Error??
AttributeError: 'NoneType' object has no attribute 'show'
bob@probotix-desktop:~/glade_tutorial$

Attached glade6.py

Bob
Attachments:
Last edit: 14 Feb 2014 08:52 by rggrieger. Reason: Redid 6 and still get same error.

Please Log in or Create an account to join the conversation.

More
11 Feb 2014 06:51 #43731 by rggrieger
Glade Tutorial 7a and 7b

I think I have 7a correct. When I ran 7b python glade7.py I received the following error:

bob@probotix-desktop:~/glade_tutorial$ python glade7.py
Traceback (most recent call last):
File "glade7.py", line 35, in <module>
main = Buglump()
File "glade7.py", line 19, in __init__
self.builder.add_from_file('data.glade')
glib.GError: Failed to open file 'data.glade': No such file or directory <<<<<<<< Can not find file???
bob@probotix-desktop:~/glade_tutorial$

I have attached 7a and 7b. 7b is a direct copy from the tutorial.

Bob
Attachments:

Please Log in or Create an account to join the conversation.

More
11 Feb 2014 12:34 #43736 by rggrieger
Glade3 Step 7 Runs OK

Glade3 Step 8 Did glade8.glade Ok I think. Used glade8.py.zip to extract it and saved it. Did chmod and ran it without errors. Dialog box showed up and captured and attached it.. Clicked on page 1 and moved it to the left and right. Clicked on page 2 but couldonly move it to the left.

Attached files 8a and 8b.

Bob
Attachments:

Please Log in or Create an account to join the conversation.

More
11 Feb 2014 13:51 #43738 by rggrieger
Hi:

Glade3 Part 9

I did 9a and 9b OK. I add a sub folder, lib and put all but main.py in it. In main.py I substituted "import lib.myclass as mc" for "import myclass as mc" and ran main.py. It produced the errors:

bob@probotix-desktop:~/glade_tutorial/glade9$ ./main.py
Traceback (most recent call last):
File "./main.py", line 3, in <module>
import lib.myclass as mc
ImportError: No module named lib.myclass <<<<<<<<<<<<< error
bob@probotix-desktop:~/glade_tutorial/glade9$

Main.py worked before theaddition of lib and putting the files in it.

Bob
Attachments:

Please Log in or Create an account to join the conversation.

More
11 Feb 2014 20:58 #43750 by BigJohnT

Glade Tutorial

I redid 6a and it seems to be OK.

I copied 6b into glade6.py. Terminal python glade6.py and received the following error:

bob@probotix-desktop:~$ cd glade_tutorial
bob@probotix-desktop:~/glade_tutorial$ chmod +x glade6.py
bob@probotix-desktop:~/glade_tutorial$ python glade6.py
ComboBox Active Text is Select an Item:
ComboBox Active Index is 0
Traceback (most recent call last):
File "glade6.py", line 55, in <module>
main = Buglump()
File "glade6.py", line 40, in __init__
self.window.show() <<<<<<<<<<< Error??
AttributeError: 'NoneType' object has no attribute 'show'
bob@probotix-desktop:~/glade_tutorial$

Attached glade6.py

Bob


That was a typo and I've fixed that... glad to know someone is using the tutorials.

JT

Please Log in or Create an account to join the conversation.

More
11 Feb 2014 21:17 #43753 by BigJohnT

Glade Tutorial 7a and 7b

I think I have 7a correct. When I ran 7b python glade7.py I received the following error:

bob@probotix-desktop:~/glade_tutorial$ python glade7.py
Traceback (most recent call last):
File "glade7.py", line 35, in <module>
main = Buglump()
File "glade7.py", line 19, in __init__
self.builder.add_from_file('data.glade')
glib.GError: Failed to open file 'data.glade': No such file or directory <<<<<<<< Can not find file???
bob@probotix-desktop:~/glade_tutorial$

I have attached 7a and 7b. 7b is a direct copy from the tutorial.

Bob


Actually two typos in 7b...

JT

Please Log in or Create an account to join the conversation.

More
12 Feb 2014 01:31 #43766 by BigJohnT

Hi:

Glade3 Part 9

I did 9a and 9b OK. I add a sub folder, lib and put all but main.py in it. In main.py I substituted "import lib.myclass as mc" for "import myclass as mc" and ran main.py. It produced the errors:

bob@probotix-desktop:~/glade_tutorial/glade9$ ./main.py
Traceback (most recent call last):
File "./main.py", line 3, in <module>
import lib.myclass as mc
ImportError: No module named lib.myclass <<<<<<<<<<<<< error
bob@probotix-desktop:~/glade_tutorial/glade9$

Main.py worked before theaddition of lib and putting the files in it.

Bob


Yes, I omitted a very important part in that one. It is fixed now.

Thanks
JT

Please Log in or Create an account to join the conversation.

More
12 Feb 2014 05:37 #43777 by rggrieger
Hi John:

I redid 9a and b and the error is still there. It works with main.py and myclass in the same directory but not with myclass in the lib directory. What is you fixed so I can look to see if it is indeed in 9a or b.

bob@probotix-desktop:~/glade_tutorial/glade9$ chmod +x main.py
bob@probotix-desktop:~/glade_tutorial/glade9$ python main.py
This is what I want to print
bob@probotix-desktop:~/glade_tutorial/glade9$


bob@probotix-desktop:~/glade_tutorial/glade9$ python main.py
Traceback (most recent call last):
File "main.py", line 3, in <module>
import lib.myclass as mc
ImportError: No module named lib.myclass <<<<<<<<<<< Error

Bob

Please Log in or Create an account to join the conversation.

More
12 Feb 2014 06:02 #43778 by BigJohnT
Aww carp, asciidoc changed my _ to make the word in italics...

You have to have an empty file named __init__.py in the same directory as the libraries. Note that is two underscores before and after init.

JT

Please Log in or Create an account to join the conversation.

More
12 Feb 2014 06:18 #43780 by rggrieger
Hi JT:

Renaming the empty file to __init__.py worked!

Part 9e has a broken link for "gtk combobox". I googled it and found a lengthy turorial, 2005, www.pygtk.org/pygtk2tutorial/index.html Ch 16 is on combobox. The tutorial is for Gtk v 2.0 and I can not find the gtk version used for the Glade 3 tutorial.

Bob

Please Log in or Create an account to join the conversation.

Moderators: HansU
Time to create page: 0.109 seconds
Powered by Kunena Forum