|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "code", |
| 5 | + "execution_count": null, |
| 6 | + "metadata": {}, |
| 7 | + "outputs": [], |
| 8 | + "source": [ |
| 9 | + "from langdetect import detect\n", |
| 10 | + "import tkinter as tk" |
| 11 | + ] |
| 12 | + }, |
| 13 | + { |
| 14 | + "cell_type": "code", |
| 15 | + "execution_count": null, |
| 16 | + "metadata": {}, |
| 17 | + "outputs": [], |
| 18 | + "source": [ |
| 19 | + "def detect_lang():\n", |
| 20 | + " window = tk.Tk()\n", |
| 21 | + " window.geometry('600x400')\n", |
| 22 | + " head = tk.Label(window, text='Language Detector', font=('Arial 15'))\n", |
| 23 | + " head.pack(pady=20)\n", |
| 24 | + "\n", |
| 25 | + " def check_language():\n", |
| 26 | + " new_text = text.get()\n", |
| 27 | + " lang = detect(str(new_text))\n", |
| 28 | + " tk.Label(window, text=lang, font=('Arial 15')).place(x=250, y=200)\n", |
| 29 | + "\n", |
| 30 | + " text = tk.StringVar()\n", |
| 31 | + " tk.Entry(window, textvariable=text).place(\n", |
| 32 | + " x=200, y=80, height=30, width=280)\n", |
| 33 | + " tk.Button(window, text='Test Language',\n", |
| 34 | + " command=check_language).place(x=300, y=150)\n", |
| 35 | + " window.mainloop()\n", |
| 36 | + "\n", |
| 37 | + "\n", |
| 38 | + "if __name__ == '__main__':\n", |
| 39 | + " detect_lang()" |
| 40 | + ] |
| 41 | + } |
| 42 | + ], |
| 43 | + "metadata": { |
| 44 | + "kernelspec": { |
| 45 | + "display_name": "Python 3.10.7 64-bit", |
| 46 | + "language": "python", |
| 47 | + "name": "python3" |
| 48 | + }, |
| 49 | + "language_info": { |
| 50 | + "codemirror_mode": { |
| 51 | + "name": "ipython", |
| 52 | + "version": 3 |
| 53 | + }, |
| 54 | + "file_extension": ".py", |
| 55 | + "mimetype": "text/x-python", |
| 56 | + "name": "python", |
| 57 | + "nbconvert_exporter": "python", |
| 58 | + "pygments_lexer": "ipython3", |
| 59 | + "version": "3.10.7" |
| 60 | + }, |
| 61 | + "orig_nbformat": 4, |
| 62 | + "vscode": { |
| 63 | + "interpreter": { |
| 64 | + "hash": "aee8b7b246df8f9039afb4144a1f6fd8d2ca17a180786b69acc140d282b71a49" |
| 65 | + } |
| 66 | + } |
| 67 | + }, |
| 68 | + "nbformat": 4, |
| 69 | + "nbformat_minor": 2 |
| 70 | +} |
0 commit comments