I am trying to make a simple app in kivy(a python package) that gets a text from a TextInput field and when a button is clicked it returns a text in Hebrew that will displayed on another TextInput, Everything seems to be working just fine but I encounter the problem that a TextInput field in Kivy could not show the Hebrew text I am trying to show.
This is what I get: As you can see, It shows this weird text instead of the text I need to show...
My code, My main script:
import kivy
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.gridlayout import GridLayout
from kivy.uix.textinput import TextInput
from kivy.uix.label import Label
from kivy.uix.widget import Widget
from kivy.properties import ObjectProperty
import getData
class MainScreen(Widget):
ttc = ObjectProperty(None)
ct = ObjectProperty(None)
def btn(self):
self.ct.text = getData.HE_EN(text=self.ttc.text.lower())
pass
class MyApp(App):
def build(self):
return MainScreen()
if __name__ == "__main__":
MyApp().run()
My "my.kv" file:
<MainScreen>:
ttc: ttc
ct: ct
GridLayout:
size: root.width, root.height
cols: 1
TextInput:
text: ""
id: ttc
Button:
text: "CONVERT"
on_press: root.btn()
TextInput:
text: "CONVERTED TEXT"
id: ct
There is no need to show the getData.py script that returns the text in Hebrew because it doesn't really matter...
The expected result is to get the text I want in the TextInput even thought I don't really manage to. Please help me fixing my issue, I really do need that...
Okay! So it didn't take a long time because someone on a discord server helped me and all I had to do was to just switch the text area font because the previous one didn't have an Hebrew font. To do it I downloaded the font "Arial" added it to my folder with the main script, I imported from kivy.core.text import LabelBase
and then registered the font: LabelBase.register(name="Arial", fn_regular="Arial.ttf")
, To tell the TextInput that I want to set the font to that I just added to my .kv file under the widget 'font_name: "Arial"' and that solved the problem.