Python Forum
typing farsi (persian) in python
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
typing farsi (persian) in python
#11
This will work:
from tkinter import*
barname=Tk()

barname.geometry('200x120')
titl = 'عنوان'
barname.title(titl)


tyLabel = Label(barname, text="راوند")


tyLabel.pack()
mainloop()
Apparently even though tkinter works for the most part in python 3,
parts of it did not get properly converted to automatically use utf.
Reply
#12
On my system, the result is as described above: the text of "titl" is replaced by small boxes.
Reply
#13
Quote:In your script/program first line is something like this:
#!/usr/bin/env python3
. Be sure that it's python3 not just python.

Is this directed at me? If so, I can assure you that I am running python 3.4.4


However, for chuckles I tried your suggestion and it works without the intermediate string.

So I went back and tried it without (the #!/usr/bin/env python3) and (on my system) it still works

So ... You are right in that it would assure python 3
Reply
#14
(Feb-21-2017, 10:49 AM)Larz60+ Wrote:
Quote:In your script/program first line is something like this:
#!/usr/bin/env python3
. Be sure that it's python3 not just python.

Is this directed at me? If so, I can assure you that I am running python 3.4.4


However, for chuckles I tried your suggestion and it works without the intermediate string.

So I went back and tried it without (the #!/usr/bin/env python3) and (on my system) it still works

So ... You are right in that it would assure python 3

No, it's not at you.  Smile
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#15
Quote:On my system, the result is as described above: the text of "titl" is replaced by small boxes.

What OS?
You cannot be using python 3, or have a not up to spec version? (it's a question)

did you try the #! suggestion?
Reply
#16
I had opend IDLE (Python 3.4 GUI - 32 bit), copied the code, saved it and run it. I would be really surprised if this should 'fall back' to Python 2 then. Anyway, I added the #! line, and the result is still the same.

My OS is WinXP, with a couple of language settings being 'German'. Can there be any kind of intereference?
Reply
#17
The #!/usr/bin/env python3 part of the line is working on Linux systems. /usr/bin/ is the path to env command.

For a Windows box this line looks different. See https://docs.python.org/3.4/using/window...m-a-script
And you can check the whole page too
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#18
Well, a change to #! python3 has no visibly effect. But maybe I misunderstood this again. That still happens sometimes.
On the other hand, I'm still quite sure that using F5 on IDLE 3 runs code in Python 3 and on IDLE 2 runs code in Python 2, as it gives the correspondig Tracebacks when the code is written for the other version.

Edit:
I experimented a bit with the proposed code snippet:
#! python2
import sys
sys.stdout.write("hello from Python %s\n" % (sys.version,))
From the command line, I got - according to the setting of the #!-line -:
Output:
C:\...>py systest.py hello from Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600  32 bit (Intel)] C:\...>py systest.py hello from Python 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Int el)]
Fine enough.

Using IDLE, I always get the output corresponding to the IDLE version. The is, running the snippet as cited (referring to python2) in IDLE 3 shows:
Output:
hello from Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)]
And it's the same vice cersa.
Reply
#19
Is it the same when you run the script from cmd?
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#20
I don't understand the question, I'm sorry. I've described first what happens from the command line, then what happens from using IDLE. If 'using the command line' is something different from 'run from cmd', I don't know the difference, that makes specific experiments difficult.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  type farsi in the sql table tkinter gray 1 3,342 Feb-24-2017, 06:50 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020