Linux Format forums Forum Index Linux Format forums
Help, discussion, magazine feedback and more
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

IDLE and gtk windows

 
Post new topic   Reply to topic    Linux Format forums Forum Index -> Magazine and coverdiscs
View previous topic :: View next topic  
Author Message
LGLudd



Joined: Sat Oct 15, 2011 11:50 am
Posts: 8

PostPosted: Sat Oct 15, 2011 12:00 pm    Post subject: IDLE and gtk windows Reply with quote

I am attempting to follow the python tutorials but have a rather odd issue. all the code works if I run python from the command line but if I use IDLE then the only commands that appear to work are those that return their results to the IDLE shell. I cannot display any gtk windows (although no errors are returned) the music player will work (in so far as music starts playing as desired)

I think that this may be either a setup or security problem (I am running Fedora 14) but cannot work out what the problem is

Any assistance would be greatly appreciated.

Thanks
Leo
Back to top
View user's profile Send private message
LGLudd



Joined: Sat Oct 15, 2011 11:50 am
Posts: 8

PostPosted: Mon Oct 17, 2011 3:55 pm    Post subject: Reply with quote

OK so I worked out part of what is happening but am not sure how to fix it.

The window is being displayed but not shown on the screen I can get the window (but not the content) to display by using IDLEs shell window and typing
Code:
w.get_position()
which tells me it is at 0,0.

I can get the window to display by adding the get_position method call to the end of my script but this feels wrong and still does not diplay the content.

What I do not understand is firstly why I do not see it initially and secondly how to fix it.

Any ideas?

Thanks
Leo
Back to top
View user's profile Send private message
evilnick
Moderator


Joined: Mon Apr 04, 2005 12:47 pm
Posts: 151
Location: LXF towers

PostPosted: Mon Oct 17, 2011 4:56 pm    Post subject: Reply with quote

I think the 'problem' is with the way gtk works. If you want to run interactively with the shell, it's fine for almost all things. If you try to execute the code (the interactive listings anyhow) then the main gtk loop has to be invoked for some things to happen.
if you add
Code:
gtk.main()

to the end of the things that don't appear to work, do they work?
Back to top
View user's profile Send private message
LGLudd



Joined: Sat Oct 15, 2011 11:50 am
Posts: 8

PostPosted: Mon Oct 17, 2011 6:51 pm    Post subject: Reply with quote

Yes that works perfectly, thanks Nick.

I was getting really frustrated by this.

Leo
Back to top
View user's profile Send private message
View previous topic :: View next topic  
Display posts from previous:   
Post new topic   Reply to topic    Linux Format forums Forum Index -> Magazine and coverdiscs All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Linux Format forums topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group


Copyright 2011 Future Publishing, all rights reserved.


Web hosting by UKFast