GUI Based Text Translation In Python 

  • By
  • April 6, 2022
  • Python
GUI Based Text Translation In Python 

GUI Based Text translation in python 

Text restatement from one language to another is gradually getting common  for colourful websites as they feed to an transnational followership. The python package which helps us do this is called translate. 

Using this module, you can take a statement and convert it from one language to another and you can specify which language you want to convert in. You obviously need to have a python installed on your computer. 

For Free, Demo classes Call: 7507414653
Registration Link: Click Here!

This package can be installed by the following way. It provides translation for  major languages. After it is installed you install Google trans module for doing  this translation. 

 

 

Put it in your command prompt shell: 

 

 

Now it should work but current version of google trans is having an issue so that’s  why I am using some alpha version when you hit enter it will install python  module.

 

 

Now you can write code any IDE environment of python like Jupiter notebook, Microsoft visual code ,pycharm, spyder etc. 

 

 

GUI using tkinter: 

Tkinter is the most regularly used library for developing GUI(Graphical User  Interface) in python.It is a standard python interface to Tk GUI toolkit shipped  with python. 

 

 

1. From tkinter import *: * means importing everything from tkinter.

2. Import tkinter as tk : Create object of tkinter library 

3. From tkinter import ttk:  The ttk module provides access to the Tk themed widget set.ttk widgets use  styles to define how they look and also a little under documented. 

4. From tkinter import messagebox : 

The tkinter.messagebox module is used to display the message boxes in the  python applications.

For Free, Demo classes Call: 7507414653
Registration Link: Click Here!

Pillow library: 

Pillow is a Python Imaging Library (PIL), which adds support for opening, manipulating, and saving images.  

Installed package using following command : 

Put command in it your command prompt shell and when you hit enter it will  install python module. 

 

 

Importing the library : 

 

 

ImageTk and Image module contains support to create and modify Tkinter. BitmapImage and PhotoImage objects from PIL images. 

One imported required library,then next step is initializing a window.

Tk(): Root window is created with the help of Tk() class. 

Title(): It is used to display the title on the top of the root window.

∙ Geometry():It is used to set size of window. 

∙ Maxsize(): It sets maximum size of window. 

∙ Minsize(): It sets minimum size of window. 

 

For Free, Demo classes Call: 7507414653
Registration Link: Click Here!

 

a is a variable that stores the language of the text that is being translated. 

 

 

l is a variable that stores the language in which the text is to be translated. 

 

 

Creating a function for translating the text:

 

 

In the translate() used two variable as an input language_1 and c1.

Translator(): It helps to translate text of language_1 variable value to c1  variable choose language text. 

Language_1 : It is the language of the text that is being translated.

c: It is the language of the text in which the text is to be translated.

get(): Value of the item is returned with the help of this method. 

 

 

In the clear() used to clear the textbox contents. 

 

For Free, Demo classes Call: 7507414653
Registration Link: Click Here!

 

Input and output Text : 

Text(): This widget helps to enter or display a single line text on the screen.

Button(): This widget creates a button. 

mainloop(): It helps to run the tkinter event loop. 

relief: It helps to provide 3-D effects around the outside of the widget.

 

 

We have successfully developed python language translator project with  translate and tkinter. 

 

Author:-

Dipali Shinkar

Call the Trainer and Book your free demo Class  Call now!!!
| SevenMentor Pvt Ltd.

© Copyright 2021 | Sevenmentor Pvt Ltd.

Submit Comment

Your email address will not be published. Required fields are marked *

*
*