ui icon indicating copy to clipboard operation
ui copied to clipboard

V UI library needs KEY BINDINGS

Open athrvvvv opened this issue 1 year ago • 0 comments

V is literally futuristic modern langauge... but here in UI library we need some of the cool features to push the library to next level We need key bindings..

For example in python using Tkinter:

import tkinter as tk

class MyWidget(tk.Frame):
    def __init__(self, parent):
        super().__init__(parent)
        self.textbox = tk.Entry(self)
        self.button = tk.Button(self, text="Enter", command=self.on_button_click)
        self.textbox.pack(side="left")
        self.button.pack(side="left")

        # Bind the button to the "enter" key
        self.textbox.bind("<Return>", self.on_enter_press)

    def on_button_click(self):
        # This function will be called when the button is clicked
        print("Button clicked")

    def on_enter_press(self, event):
        # This function will be called when the "enter" key is pressed
        self.button.invoke()
        
root = tk.Tk()
# Set the default size of the window
root.geometry("500x500")
widget = MyWidget(root)
widget.pack()
root.mainloop()

Here, in this simple application we have bided the button with enter key. When I click enter key it atomatically clicks the button.

But I've not seen or Iam not aware of such things in this UI library? any suggestions? or anything?

athrvvvv avatar Jan 08 '23 07:01 athrvvvv