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

2
  • Try making root window topmost and TopBar a transient child window of root window. Commented Jan 5, 2022 at 10:14
  • if the root window is set to root.wm_attributes("-topmost", True), full-screen xfreerdp still overlaps it Commented Jan 5, 2022 at 19:00

1 Answer 1

-2

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.