0

I'm writing a lightweight client for xfreerdp in python + tkinter. At the top of the screen, I've placed a menu with buttons that should appear on top of all programs. And it works as long as I don't use the /f switch for xfreerdp. As I understood wm_attributes ("-topmost", True) does not work if another program was launched in full-screen mode.

Is there another way in tkinter to display Toplevel on top of full-screen apps?

Or a way to run xfreerdp inside a tkinter window?

Or a similar method using a different GUI for Python?

from tkinter import *
import subprocess


# ======== MAIN MENU ========
root = Tk()

RootWindowsWidth = 600
RootWindowHeight = 350
#Define display resolution
ScrWdth = root.winfo_screenwidth()
ScrHgth = root.winfo_screenheight()
#Define margine for main menu
RootXLeft = round((ScrWdth/2) - (RootWindowsWidth/2))
RootYTop = round((ScrHgth/2) - (RootWindowHeight/2))
#Main menu settings
root.geometry(str(RootWindowsWidth) + "x" + str(RootWindowHeight) + "+" + str(RootXLeft) + "+" + str(RootYTop))
root['bg'] = '#fafafa'
root.title('MyRDP')
root.wm_attributes('-alpha', 1)

# Global variable for TopBar
TopBarWindowsWidth = 600
TopBarWindowHeight = 20
TopBarXLeft= round((ScrWdth/2) - (TopBarWindowsWidth/2))
TopBarYTop = 0

# ======== TOP MENU ========
global TopBar
TopBar = Toplevel()

TopBar.geometry(str(TopBarWindowsWidth) + "x" + str(TopBarWindowHeight) + "+" + str(TopBarXLeft) + "+" + str(TopBarYTop))
TopBar.wm_attributes('-alpha', 0.85)
TopBar.attributes('-type', 'dock')
TopBar.wm_attributes("-topmost", True)

TopButton01 = Button(TopBar, text='BTN1')
TopButton02 = Button(TopBar, text='BTN2')

TopButton01.grid(row=0,column=0)
TopButton02.grid(row=0,column=2)


# ======== Functions ========
#RDP connect button
def btn_click():
    subprocess.call("gnome-terminal -x xfreerdp /cert-ignore /v:192.168.31.63 /u:user /d:vm2 /p:123 /f", shell=True)

#Exit button
def btn_quit():
    root.quit()


# ======== MAIN MENU CONFIG ========
canvas = Canvas(root, height=350, width=600)
canvas.pack()

frame = Frame(root, bg='green')
frame.place(relx=0.15, rely=0.15, relwidth=0.7, relheight=0.7)

btn = Button(frame, text='RDP', bg='yellow', command=btn_click)
btn.pack()
btn = Button(frame, text='Close', bg='orange', command=btn_quit)
btn.pack()


root.mainloop()

Screenshot of my programm

Cristian Ciupitu
  • 20,270
  • 7
  • 50
  • 76
volgraft
  • 1
  • 1
  • Try making root window *topmost* and `TopBar` a *transient* child window of root window. – acw1668 Jan 05 '22 at 10:14
  • if the root window is set to **root.wm_attributes("-topmost", True)**, full-screen xfreerdp still overlaps it – volgraft Jan 05 '22 at 19:00

1 Answers1

-2

So far I'm just use "/floatbar:sticky:off,default:visible,show:fullscreen" and "/multimon" xfreerdp options.That enought for now.

volgraft
  • 1
  • 1