Shaurya
Shaurya

Reputation: 13

How to show tkinter buttons in mac touch bar

I have a tkinter application and want to display some of its buttons in the Mac Touch Bar. For Example

from tkinter import *

root = Tk()
    
send_button = Button(text = "Send",bg = 'sky blue',fg = 'black',font = "size 15",pady = 5)
send_button.grid()
    
root.mainloop()

So I want to integrate the send_button to show up in the Touch Bar, so is there a way to do that in tkinter.

Upvotes: 1

Views: 660

Answers (1)

user14868470
user14868470

Reputation:

There is a Package called PyTouchBar. I think this would help. https://github.com/Maxmad68/PyTouchBar/wiki

As an Example:

root = Tk()
PyTouchBar.prepare_tk_windows(root)


def function(button):
    print('Button clicked!')


button = PyTouchBar.TouchBarItems.Button(title='Click me!', action=function)
PyTouchBar.set_touchbar([button])

root.mainloop()

Upvotes: 0

Related Questions