Open In App
Related Articles

Python | Vkeyboard (virtual keyboard) in kivy

Improve Article
Improve
Save Article
Save
Like Article
Like

Kivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications.

Vkeyboard:

VKeyboard is an onscreen keyboard for Kivy. Its operation is intended to be transparent to the user. Using the widget directly is NOT recommended. Read the section Request keyboard first.

Modes in Vkeyboard:

This virtual keyboard has a docked and free mode:

  • Docked mode: (VKeyboard.docked = True) Generally used when only one person is using the computer, like a tablet or personal computer etc.
  • Free mode: (VKeyboard.docked = False) Mostly for multitouch surfaces. This mode allows multiple virtual keyboards to be used on the screen.

If the docked mode changes, you need to manually call VKeyboard.setup_mode() otherwise, the change will have no impact.

During that call, the VKeyboard, implemented on top of a Scatter, will change the behavior of the scatter and position the keyboard near the target (if target and docked mode are set).

Basic Approach:
1) import kivy
2) import kivyApp
3) import vkeyboard
4) set kivy version (optional)
5) Create the Vkeyboard class
6) Create the App class
7) return the vkeyboard class
8) Run the App

# Implementation of the Approach:




# import kivy module  
import kivy  
      
# this restricts the kivy version i.e  
# below this kivy version you cannot  
# use the app or software  
kivy.require("1.9.1")  
      
# base Class of your App inherits from the App class.  
# app:always refers to the instance of your application  
from kivy.app import App
  
# VKeyboard is an onscreen keyboard
# for Kivy. Its operation is intended
# to be transparent to the user. 
from kivy.uix.vkeyboard import VKeyboard
  
# Create the vkeyboard
class Test(VKeyboard):
    player = VKeyboard()
  
# Create the App class
class VkeyboardApp(App):
    def build(self):
        return Test()
  
# run the App
if __name__ == '__main__':
    VkeyboardApp().run()


Output:

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 05 Sep, 2019
Like Article
Save Article
Previous
Next
Similar Reads
Complete Tutorials