Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 29th, 2004, 07:51 AM
banjoman banjoman is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 3 banjoman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
SetTopWindow

I am calling python through a C++ application, the tkinter window comes up but is behind the mswindow and I need to bring it to the foreground.
I am using code similar to this (am not at my python pc at the moment so the code may not be exact)

Code:
myProc = win32api.GetProcessId()
win32gui.SetTopWindow(myProc.HWND)
app.mainloop()

I am receiving an error with myProc.HWND not being a true handle. I have tried the GetProcess() with no luck either. Has anyone ever solved this problem?
thanks

Reply With Quote
  #2  
Old October 29th, 2004, 09:16 AM
Grim Archon's Avatar
Grim Archon Grim Archon is offline
Mini me.
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2003
Location: Cambridge, UK
Posts: 783 Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)  Folding Points: 1488 Folding Title: Novice Folder
Time spent in forums: 3 Days 2 h 15 m 57 sec
Reputation Power: 8
Send a message via MSN to Grim Archon
I don't think you need the win32api for this as Tkinter has it's own methods:
http://www.pythonware.com/library/tkinter/introduction/x9531-window-management.htm

But you can get HWND with the Tkinter winfo_id() method. Which I guess can be plugged into win32 calls.

grim
__________________
*** Experimental Python Markup CGI V2 ***

Last edited by Grim Archon : October 29th, 2004 at 09:19 AM.

Reply With Quote
  #3  
Old October 29th, 2004, 09:21 AM
banjoman banjoman is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 3 banjoman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Originally Posted by Grim Archon
I don't think you need the win32api for this as Tkinter has it's own methods:
http://www.pythonware.com/library/tkinter/introduction/x9531-window-management.htm

grim


EDIT: Its a little early for me...I will try all your suggestions first before asking more questions...sorry

Thankyou for you reply.
I will look into that however I would appreciate it if you could point me in some direction ( give me the function I should be looking into) because the top window methods I have found with Tkinter only places the window on top of other Tkinter windows, not mswindows...perhaps I am missing something.

Reply With Quote
  #4  
Old October 30th, 2004, 03:08 AM
Grim Archon's Avatar
Grim Archon Grim Archon is offline
Mini me.
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2003
Location: Cambridge, UK
Posts: 783 Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)  Folding Points: 1488 Folding Title: Novice Folder
Time spent in forums: 3 Days 2 h 15 m 57 sec
Reputation Power: 8
Send a message via MSN to Grim Archon
Your right about the raise method on it's own but in combination with focus_force()
Code:
    mywin = Toplevel()
    
    win32gui.BringWindowToTop(mywin.winfo_id())
    #or ....
    mywin.lift()
    
    mywin.focus_force()

you should get what you want.

grimey

Last edited by Grim Archon : October 30th, 2004 at 03:10 AM.

Reply With Quote
  #5  
Old October 30th, 2004, 03:34 PM
banjoman banjoman is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 3 banjoman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Originally Posted by Grim Archon
Your right about the raise method on it's own but in combination with focus_force()
Code:
    mywin = Toplevel()
    
    win32gui.BringWindowToTop(mywin.winfo_id())
    #or ....
    mywin.lift()
    
    mywin.focus_force()

you should get what you want.

grimey


So simple when you see the answer.
thankyou

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > SetTopWindow


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT