Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V UI library needs KEY BINDINGS #495

Open
athrvvvv opened this issue Jan 8, 2023 · 0 comments
Open

V UI library needs KEY BINDINGS #495

athrvvvv opened this issue Jan 8, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@athrvvvv
Copy link

athrvvvv commented Jan 8, 2023

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 athrvvvv added the enhancement New feature or request label Jan 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant