Skip to content
Related Articles

Related Articles

Python | Vkeyboard (virtual keyboard) in kivy
  • Last Updated : 05 Sep, 2019

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:

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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()

chevron_right


Output:

Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :