class PersianLoginWindow(Screen):
user1 = ObjectProperty(None)
password1 = ObjectProperty(None)
password1_label = ObjectProperty(None)
user1_label = ObjectProperty(None)
login_button1 = ObjectProperty(None)
def __init__(self, **kwargs):
super(PersianLoginWindow, self).__init__(**kwargs)
and .kv file
<PersianLoginWindow>:
name: "PersianLogin"
font_name: 'data/fonts/DejaVuSans.ttf'
user1:user1
password1:password1
password1_label:password1_label
user1_label:user1_label
login_button1:login_button1
FloatLayout:
canvas.before:
Color:
rgba: 1, 1, 1, 1
Rectangle:
# self here refers to the widget i.e BoxLayout
pos: self.pos
size: self.size
FloatLayout:
pos_hint: {"x":0.225, "y":0.225}
size_hint: 0.55, 0.55
canvas.before:
Color:
rgba: .9, .9, .9, 1
RoundedRectangle:
pos: self.pos
size: self.size
radius: [10,]
#Rectangle:
# self here refers to the widget i.e BoxLayout
#pos: self.pos
#size: self.size
FloatLayout:
pos_hint: {"x":0.25, "y":0.25}
size_hint: 0.5, 0.5
canvas.before:
Color:
rgba: .7, .7, .7, 1
#Rectangle:
# self here refers to the widget i.e BoxLayout
#pos: self.pos
#size: self.size
RoundedRectangle:
pos: self.pos
size: self.size
radius: [10,]
TextInput:
keyboard_suggestions: True
suggestion_text: "admin"
#background_color:0.6,0.4,0.5,1
#cursor_blink:True,
#background_color:1,1,1,1
#background_color: 0, 0, 0, 0
text:''
#cursor_color: 1, 1, 1, 1
#foreground_color: 1, 1, 1, 1
id: user1
#font_size: (root.width**2 + root.height**2) / 13**4.3
font_size: 10
multiline: False
pos_hint: {"x": 0.425 , "y":0.625}
size_hint: 0.3, 0.075
Label:
#text:get_display("User: ")
text: get_display(arabic_reshaper.reshape('نام کاربری'))
color: 0,0,0,1 # <-----------
canvas.before:
Color:
rgba: .7, .7, .7, 1
Rectangle:
pos: self.pos
size: self.size
font_name: 'fonts/DejaVuSans.ttf'
#font_name: 'fonts/DejaVuSans.ttf'
#time.sleep( .5 )
text: get_display(arabic_reshaper.reshape('نام کاربری'))
#text:"نام کاربری "
#text: get_display(arabic_reshaper.reshape(u'نام'))
id:user1_label
#importlib.reload(user1_label)
#self.user1_label.pos_hint= {"x":0.725, "y":0.525}
#font_size: (root.width**2 + root.height**2) / 13**4.3
font_size: 14
pos_hint: {"x":0.725, "y":0.625}
size_hint: 0.25, 0.1
Label:
#text:"Password: "
color: 0,0,0,1 # <-----------
canvas.before:
Color:
rgba: .7, .7, .7, 1
Rectangle:
pos: self.pos
size: self.size
font_name: 'fonts/DejaVuSans.ttf'
text: get_display(arabic_reshaper.reshape('رمز عبور'))
#text:"رمز عبور "
#font_name: 'data/fonts/DejaVuSans.ttf'
#font_name: "font/arial"
id:password1_label
#sys.stdout.buffer.write(text.encode("utf-8"))
#font_size: (root.width**2 + root.height**2) / 13**4.3
font_size: 14
#self.password1_label.pos_hint= {"x":0.725, "y":0.425}
pos_hint: {"x":0.725, "y":0.525}
size_hint: 0.25, 0.1
TextInput:
id: password1
#background_color: 0.6,0.4,0.5,1
cursor_blink:True
# background_color:1,1,1,1
#background_color: 0, 0, 0, 0
foreground_color: (1, 0, 0, 1)
#hint_text:'Placeholder'
#color: 1, 1, 1, 1
#cursor_color: 1, 0, 0, 1
font_size: 10
multiline: False
pos_hint: {"x": 0.425 , "y":0.525}
size_hint: 0.3, 0.075
password: True
SmoothButton:
#background_color: 1, 1, 0, 1
color: 1,0,1,1 # <-----------
canvas.before:
Color:
rgba: .7, .7, .7, 1
Rectangle:
pos: self.pos
size: self.size
Color:
rgba: .7, .7, .7, 1
font_color: 1,0,1,1
id:login_button1
#self.login_button1.pos_hint= {"x":0.11, "y":0.6}
pos_hint:{"x":0.55, "y":0.4}
size_hint: 0.2, 0.1
#font_size: (root.width**2 + root.height**2) / 13**4.3
font_size: 12
#text: "Login"
font_name: 'fonts/DejaVuSans.ttf'
text: get_display(arabic_reshaper.reshape('ورود'))
on_release:
app.root.current = "pannel_table" if root.loginBtn() else "PersianLogin"
root.manager.transition.direction = "up"
SmoothButton:
color: 0,0,0,1
id:farsi_button
pos_hint:{"x":0,"y":0.9}
size_hint: 0.2, 0.1
#font_size: (root.width**2 + root.height**2) / 13**4.3
font_size: 12
#text: "Farsi"
font_name: 'fonts/DejaVuSans.ttf'
text: get_display(arabic_reshaper.reshape('فارسی'))
on_release:
#root.show_farsi_text()
root.manager.transition.direction = "right"
app.root.current = "PersianLogin"
root.change_default_lang_db("Persian")
Button:
id:Engilsh_button
pos_hint:{"x":0.2,"y":0.9}
size_hint: 0.2, 0.1
#font_size: (root.width**2 + root.height**2) / 13**4.3
font_size: 12
#text: "ٍEnglish"
font_name: 'fonts/DejaVuSans.ttf'
text: get_display(arabic_reshaper.reshape('English'))
on_release:
#root.show_farsi_text()
root.manager.transition.direction = "left"
app.root.current = "login"
root.change_default_lang_db("English")
Button:
id:Arabic_button
pos_hint:{"x":0.4,"y":0.9}
size_hint: 0.2, 0.1
#font_size: (root.width**2 + root.height**2) / 13**4.3
font_size: 12
#text: "ٍEnglish"
font_name: 'fonts/DejaVuSans.ttf'
text: get_display(arabic_reshaper.reshape('العربية'))
#background_color:0.6,0.4,0.5,1
#border: 30,30,30,30
on_release:
#root.show_farsi_text()
root.manager.transition.direction = "down"
app.root.current = "ArabicLogin"
root.change_default_lang_db("Arabic")
#text:'Multi\nLine'
multiline:True
#text:"رمز عبور "
#font_name: 'data/fonts/DejaVuSans.ttf'
#font_name: "font/arial"
id:website_label
#sys.stdout.buffer.write(text.encode("utf-8"))
#font_size: (root.width**2 + root.height**2) / 13**4.3
font_size: 14
#self.password1_label.pos_hint= {"x":0.725, "y":0.425}
pos_hint:{"x":0.5071428571428571, "y":0.3}
size_hint: 0.35, 0.1Here is my output. As you see no text for buttons
my python
dirpath = (pathlib.PureWindowsPath(dirpath)).as_posix()
current_folder_path, current_folder_name = os.path.split(os.getcwd())
class PersianLoginWindow():
user1 = ObjectProperty(None)
password1 = ObjectProperty(None)
password1_label = ObjectProperty(None)
user1_label = ObjectProperty(None)
login_button1 = ObjectProperty(None)
def __init__(self, **kwargs):
super(PersianLoginWindow, self).__init__(**kwargs)
with open(dirpath+"/test.kv", encoding='utf-8') as f: # Note the name of the .kv
kv = Builder.load_string(f.read())
class MyMainApp(App):
def build(self):
return kv
my_app = MyMainApp()
if __name__ == "__main__":
my_app = MyMainApp()
my_app.run()
<PersianLoginWindow>:
user1:user1
password1:password1
password1_label:password1_label
user1_label:user1_label
login_button1:login_button1
FloatLayout:
canvas.before:
Color:
rgba: 1, 1, 1, 1
Rectangle:
# self here refers to the widget i.e BoxLayout
pos: self.pos
size: self.size
FloatLayout:
pos_hint: {"x":0.225, "y":0.225}
size_hint: 0.55, 0.55
canvas.before:
Color:
rgba: .9, .9, .9, 1
RoundedRectangle:
pos: self.pos
size: self.size
radius: [10,]
text: get_display(arabic_reshaper.reshape('نام کاربری'))
color: 0,0,0,1 # <-----------
canvas.before:
Color:
rgba: .7, .7, .7, 1
Rectangle:
pos: self.pos
size: self.size
font_name: 'fonts/DejaVuSans.ttf'
text: get_display(arabic_reshaper.reshape('نام کاربری'))
id:user1_label
cursor_blink:True
# background_color:1,1,1,1
foreground_color: (1, 0, 0, 1)
font_size: 10
multiline: False
pos_hint: {"x": 0.425 , "y":0.525}
size_hint: 0.3, 0.075
password: True
Button:
#background_color: 1, 1, 0, 1
color: 1,0,1,1 # <-----------
canvas.before:
Color:
rgba: .7, .7, .7, 1
Rectangle:
pos: self.pos
size: self.size
Color:
rgba: .7, .7, .7, 1
font_color: 1,0,1,1
id:login_button1
pos_hint:{"x":0.55, "y":0.4}
size_hint: 0.2, 0.1
font_size: 12
font_name: 'fonts/DejaVuSans.ttf'
text: get_display(arabic_reshaper.reshape('ورود'))
on_release:
app.root.current = "pannel_table" if root.loginBtn() else "PersianLogin"
root.manager.transition.direction = "up"
Button:
color: 0,0,0,1
id:farsi_button
pos_hint:{"x":0,"y":0.9}
size_hint: 0.2, 0.1
#font_size: (root.width**2 + root.height**2) / 13**4.3
font_size: 12
#text: "Farsi"
font_name: 'fonts/DejaVuSans.ttf'
text: get_display(arabic_reshaper.reshape('فارسی'))
Button:
id:Engilsh_button
pos_hint:{"x":0.2,"y":0.9}
size_hint: 0.2, 0.1
#font_size: (root.width**2 + root.height**2) / 13**4.3
font_size: 12
font_name: 'fonts/DejaVuSans.ttf'
text: get_display(arabic_reshaper.reshape('English'))
Button:
id:Arabic_button
pos_hint:{"x":0.4,"y":0.9}
size_hint: 0.2, 0.1
#font_size: (root.width**2 + root.height**2) / 13**4.3
font_size: 12
#text: "ٍEnglish"
font_name: 'fonts/DejaVuSans.ttf'
text: get_display(arabic_reshaper.reshape('العربية'))
#background_color:0.6,0.4,0.5,1
#border: 30,30,30,30
.kv<PersianLoginWindow>:
user1:user1
password1:password1
password1_label:password1_label
user1_label:user1_label
login_button1:login_button1
FloatLayout:
canvas.before:
Color:
rgba: 1, 1, 1, 1
Rectangle:
# self here refers to the widget i.e BoxLayout
pos: self.pos
size: self.size
FloatLayout:
pos_hint: {"x":0.225, "y":0.225}
size_hint: 0.55, 0.55
canvas.before:
Color:
rgba: .9, .9, .9, 1
RoundedRectangle:
pos: self.pos
size: self.size
radius: [10,]
text: get_display(arabic_reshaper.reshape('نام کاربری'))
color: 0,0,0,1 # <-----------
canvas.before:
Color:
rgba: .7, .7, .7, 1
Rectangle:
pos: self.pos
size: self.size
font_name: 'fonts/DejaVuSans.ttf'
text: get_display(arabic_reshaper.reshape('نام کاربری'))
id:user1_label
cursor_blink:True
# background_color:1,1,1,1
foreground_color: (1, 0, 0, 1)
font_size: 10
multiline: False
pos_hint: {"x": 0.425 , "y":0.525}
size_hint: 0.3, 0.075
password: True
Button:
#background_color: 1, 1, 0, 1
color: 1,0,1,1 # <-----------
canvas.before:
Color:
rgba: .7, .7, .7, 1
Rectangle:
pos: self.pos
size: self.size
Color:
rgba: .7, .7, .7, 1
font_color: 1,0,1,1
id:login_button1
pos_hint:{"x":0.55, "y":0.4}
size_hint: 0.2, 0.1
font_size: 12
font_name: 'fonts/DejaVuSans.ttf'
text: get_display(arabic_reshaper.reshape('ورود'))
on_release:
app.root.current = "pannel_table" if root.loginBtn() else "PersianLogin"
root.manager.transition.direction = "up"
Button:
color: 0,0,0,1
id:farsi_button
pos_hint:{"x":0,"y":0.9}
size_hint: 0.2, 0.1
#font_size: (root.width**2 + root.height**2) / 13**4.3
font_size: 12
#text: "Farsi"
font_name: 'fonts/DejaVuSans.ttf'
text: get_display(arabic_reshaper.reshape('فارسی'))
Button:
id:Engilsh_button
pos_hint:{"x":0.2,"y":0.9}
size_hint: 0.2, 0.1
#font_size: (root.width**2 + root.height**2) / 13**4.3
font_size: 12
font_name: 'fonts/DejaVuSans.ttf'
text: get_display(arabic_reshaper.reshape('English'))
This is not a runnable example.
Imports are missing, get_display is not defined.
I suggest you build a trivial app, just one button that uses the get_display() function and see if it is working. Does get_display() return a string? It would need to have text show up on the buttons.
text: get_display(arabic_reshaper.reshape('نام کاربری'))
Looking at the doc for bidi.get_display, if the encoding is not specified it defaults to utf-8, that could be part of the problem.
--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/412c4f9c-f773-48e1-a27a-9925b1985ae3%40googlegroups.com.
This is what a minimum example looks like. I was able to pip install both Arabic reshaper and python-bidi.
Python:
from kivy.app import App
from kivy.lang import Builder
with open('test2.kv', encoding='utf-8', errors='ignore') as f:
kv = f.read()
print(kv)
class MyMainApp(App):
def build(self):
return Builder.load_string(kv)
if __name__ == "__main__":
MyMainApp().run()
test2.kv:
#:import get_display bidi.algorithm.get_display
#:import arabic_reshaper arabic_reshaper
BoxLayout:
Button:
font_size: 12
font_name: 'fonts/DejaVuSans.ttf'
text: get_display(arabic_reshaper.reshape('English'))
Button:
font_size: 12
font_name: 'fonts/DejaVuSans.ttf'
text: get_display(arabic_reshaper.reshape('فارسی'))
Button:
text: 'Default Button'
Text shows up on the button, but I don’t know if this is correct.
From: Electronic Part
Sent: Monday, November 25, 2019 10:31 PM
To: Kivy users support
Subject: [kivy-users] Re: Button texts are not showing up
This is an examole
--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/57fa779b-92ba-4edc-83f7-b01608757e09%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/5ddd5c91.1c69fb81.5820.73f0SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
Can you see any text or just not the Arabic?
I did a pip install of Arabic_reshaper, I did not use the included in the zip.
On my system I had to open the kivy file with errors=’ignore’, or I would get a Unicode exception.
with open('test2.kv', encoding='utf-8', errors='ignore') as f:
You might want to check that things are working as you expect without kivy. I ran this code to test my installs:
import arabic_reshaper
from bidi.algorithm import get_display
r = arabic_reshaper.reshape('فارسی')
print(r)
b = get_display(r)
print(b)
From: Electronic Part
Sent: Monday, November 25, 2019 10:31 PM
To: Kivy users support
Subject: [kivy-users] Re: Button texts are not showing up
This is an examole
--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/57fa779b-92ba-4edc-83f7-b01608757e09%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/5ddd5c91.1c69fb81.5820.73f0SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CACYZbMUdafn3fAQ7HYBBjzFY4t-pJqxA0_vR06exg8cXdgPvGw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/5dde0ca8.1c69fb81.c325e.a02bSMTPIN_ADDED_MISSING%40gmr-mx.google.com.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/57fa779b-92ba-4edc-83f7-b01608757e09%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/5ddd5c91.1c69fb81.5820.73f0SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CACYZbMUdafn3fAQ7HYBBjzFY4t-pJqxA0_vR06exg8cXdgPvGw%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/091db08c-266d-4c5d-a5ab-0b0a29534a10%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/091db08c-266d-4c5d-a5ab-0b0a29534a10%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/77e6bbea-bf59-468e-81f0-7927c251b281%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/77e6bbea-bf59-468e-81f0-7927c251b281%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/2a91b1e4-6924-4ec3-bf5c-396ff400adc5%40googlegroups.com.
Make sure your graphics driver is up to date.
The other possibility is that kivy and the kivy dependencies are not at the correct level.
Share the contents of a log file, it might provide some other clues. On Windows, the log files are stored at:
C:\Users\Your User Name\.kivy\logs
From: elec part
Sent: Wednesday, November 27, 2019 1:39 AM
To: kivy-...@googlegroups.com
Subject: Re: [kivy-users] Re: Button texts are not showing up
When i changed label to button again it is not working
On Wed, 27 Nov 2019 at 12:04, elec part <pele...@gmail.com> wrote:
Yeah. Hello World worked. Seems we have this issue only .kv file
On Wed, 27 Nov 2019 at 11:43, Robert Flatt <planckp...@gmail.com> wrote:
Great, but we need to figure out the cause of the issue in order to propose a solution.
This one has become VERY important, please try this:
Does Hello World display text.?
Somewhere here in the last few months it seems like there was an issue with Anaconda here, but I cant find it.
The Kivy version shown is 1.10.1 the current is 1.11.1 not certain about the deps versions, but they are there.
Not optimal but should not give this issue.
Both of these next questions are important:
What is the Anaconda Python version?
Does the video driver support OpenGL 2.0 ?
Getting closer....
On Tuesday, November 26, 2019 at 9:42:16 PM UTC-10, elec part wrote:
Here is my code. I know that is strange. I want to know if there is anything in kivy that helps me. I might forgot to install some dependencies. I used anaconda for kivy installation
On Wed, 27 Nov 2019 at 11:01, Robert Flatt <planckp...@gmail.com> wrote:
Thank you. That is strange.
What was the .kv for that image?
Does Hello World display text?
On Tuesday, November 26, 2019 at 9:18:15 PM UTC-10, elec part wrote:
This is the screenshot of what i got. As you see, no text
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CACYZbMULXNDT9R5Wqc1n1m58VmSRMuJv_Ysy8EaACSK_yehq7g%40mail.gmail.com.
When i changed label to button again it is not working
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/2a91b1e4-6924-4ec3-bf5c-396ff400adc5%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CACYZbMULXNDT9R5Wqc1n1m58VmSRMuJv_Ysy8EaACSK_yehq7g%40mail.gmail.com.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/64808f13-94e2-4bbd-96f6-1887668eb81a%40googlegroups.com.
Could you please provide me installation instruction of kivy for version 1.10.1
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/64808f13-94e2-4bbd-96f6-1887668eb81a%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/20f67fcc-64ec-4857-83e7-b57b2e6c4ba4%40googlegroups.com.
From the Documentation of 1.10.1:
Module: kivy.adapters
Added in 1.5.0
Deprecated since version 1.10.0: The feature has been deprecated.
Use Recycleview to replace the listadapter: https://kivy.org/doc/master/api-kivy.uix.recycleview.html
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CACYZbMUauxUA1V78G-hyGryuhWuHK37PdmrDF6Q1Z022YsUvew%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/5de28fd4.1c69fb81.cabe0.4118SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/120d7eed-588d-44e1-8243-0dcc9c9ae633%40googlegroups.com.
On Nov 30, 2019, at 9:52 PM, elec part <pele...@gmail.com> wrote:
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CACYZbMXjGMc4%3D%3DYwFe6qm3HbpBNM0vgyGcPOfBFOX%2BuzQ308Uw%40mail.gmail.com.