Hi to all,
i'm writing a little interface in python with Tkinter on linux debian,
with this interface i need to execute some program like rdesktop and vnc. but i've a little problem:
i use a fullscreen window without decorator (read buttons for iconify and close) where i've putted some buttons.
the problem is that when i call vnc i the server doesn't respond vncviewer show a error message window but this window stay always under the main window. so i can't see it.
i've tried to put the interface into a window not fullscreen and all goes well, but i need fullscreen so
what i have to do for to see this window over all?

thank's to all
Giorgio

the code i use i similar to (i've rewrited some code here for demo purpose but not tested...):

import subprocess
from Tkinter import *
class mywindow
    def __init__(self):
        self.mw=Tk()
        sw,sh=self.mw.winfo_screenwidth(),self.mw.winfo_screenheight()
        self.mw.geometry("%dx%d+0+0"%(sw,sh))
        self.mw.resizable(0,0)
        self.mw.attributes("-fullscreen",1)
        self.bt=Button(self.mx,text='vnc',command=self.callvnc)
        self.bt.pack()
        self.ex=Button(self.mw,text='close',command=self.mw.destroy)
        self.ex.pack()
        self.mw.mainloop()

    def callvnc(self):
        server = '192.168.1.1'  # put your vnc server ip
        pp=subprocess.Popen(['vncviewer','-xdialog',server])

This way does not work?

Tkinter way
------------------------
<toplevel>.wm_attributes("-topmost", 1)   # Make sure window remains on
top of all others
<toplevel>.focus()                        # Set focus to window

Thank's for answer, but maybe i did'n explained well.
i try a new:
my fullscreen windw stay ever ont top and other windows called by other button (not inserted in demo code)
goes over correctly.
the problem is when i click the vnc button, this app has own windows - for ask password and show messages like
"unable to connect" - and this stay under the fullscreen main window.
so how i can do to show vncviewer own windows on top?
thank's to all
Giorgio

You set the topmost flag to the vncviewer or temporary remove topmost flag from your app and give focus to vncviewer window. Or maybe best would be temporary minimize the fullscreen window until interaction finish with vncviewer.

Thank's for asnwer
i've tried to temporary minimize the fullscreen main window, but i've a question for the procedure to use for call
an external program: in the demo code i've used subprocess.Popen because i've read that it's better than os.system
and it's more performant, and unwait the end of the execution - run in parallel - so now the mainwindow close, start vncviewer
and restore the fullscreen window without the time to click on the "error message" window.

the new code:

def callvnc(slef):
    self.mw.withdraw()
    p=subprocess.Popen(['vncviewer','-xdialog','192.168.1.1'])
    self.mv.deiconify()

so i ask if it's better for may application to wait until the vnc session it's closed or to execute external app in a parallel process?

one more: how to put the vncviewer in a window? i've tried until now and i seen that vncviewer fill the screen without the need
of a container.
bye
Giorgio

the problem is when i click the vnc button, this app has own windows - for ask password and show messages like "unable to connect" - and this stay under the fullscreen main window.

You can use focus_set, i.e self.parent.focus_set(), self.password_entry.focus_set(). Start by reading this page

Thank's wooee,
but with "it's own window" i mean that the parameter -xdialog used in the command string force the vncviewer
to output every message on it's own window, but not created with Tkinter mode.
if you try the piece of code i wrote, add

myapp = mywindow()

so you can try
i know that if i comment the row 9 my little app create a window at fullscreen where i can see the top bar
with the three buttons close,iconify and fullscreen, and so this window can be lifted or lowered

but after some other tests i found that the fullscreen window is ever topmost! i use the transient method
with the other window i create in the app, but the window created by vncviewer stay under.
there is a solution?
maybe i iconify and deiconify but it's no elegant!
Giorgio

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.