Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to show Screen keyboard ubuntu with python

#!/usr/bin/env python3
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
import signal
import subprocess

class CallKeyboardTest:

    def __init__(self):
        
        # window definition
        window = Gtk.Window(title="Test 123")
        window.connect('destroy', Gtk.main_quit)
        # maingrid
        maingrid = Gtk.Grid()
        maingrid.set_border_width(12)
        window.add(maingrid)
        # two different fields, one is calling the keyboard, the other isn't
        testfield = Gtk.Entry()
        testfield.connect('focus-in-event', self.focus_in)
        testfield.connect('focus-out-event', self.focus_out)
        otherfield = Gtk.Entry()
        maingrid.attach(testfield, 0, 0, 1, 1)
        maingrid.attach(otherfield, 0, 1, 1, 1)
        window.show_all()
        Gtk.main()
        
    def focus_out(self, entry, event):
        subprocess.Popen(["pkill", "onboard"])

    def focus_in(self, entry, event):
        subprocess.Popen("onboard")

    def stop_prefs(self, *args):
        Gtk.main_quit()

if __name__ == "__main__":
    CallKeyboardTest()
Comment

PREVIOUS NEXT
Code Example
Python :: create multi new column from apply pandas 
Python :: number of features classification model jupyter notebook 
Python :: create matrice 2d whit 3colum panda 
Python :: For an HTML output, you don’t need an additional library. It simply goes like this: 
Python :: block url selenium python 
Python :: cumulative some by date for each user 
Python :: without using sum add item in list python 
Python :: break line text opencv 
Python :: finding the min an max values of grayscale image or frame 
Python :: python von konsoleeinlesen 
Python :: tyjacsav 
Python :: numpy count occurrences in interval array 
Python :: set column as category datatype 
Python :: multigreading sys.exit does not work 
Python :: spacy print word in vocab 
Python :: relative import package/module __init__.py 
Python :: pie chart eda syntax 
Python :: dataproc initialization_actions error 
Python :: 2D array questions python 
Python :: training T5 for summarization 
Python :: Tabpy Configuration file with custom settings 
Python :: python print x y coordinates 
Python :: python format method align center 
Python :: logistic distribution location and scale parameters 
Python :: print dataframe row horizontally 
Python :: form is undefined flask 
Python :: cant access a dataframe imported using pickle 
Python :: spark group by alias 
Python :: how to get a random number between 1 and 10 in python 
Python :: django route accept params with character 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =