On Tue, 12 Jan 2010 18:36:01 +0200
Engin Yüce <[email protected]> wrote:

> Merhaba,
> 
> Python ile yazdığım bir program için curses ile text-based UI
> gelistirmekteydim, fakat curses ile unicode karakterleri göstermeyi
> başaramadım. Aşağıda çalışan örnek bir kod yazıyorum. Yardımlarınız
> için şimdiden teşekkürler:


 Programın locale bilgisini alması lazım, import un altına şu satırları
ekleyin

import locale
locale.setlocale(locale.LC_ALL, '')


> 
> İyi çalışmalar,
> -engin
> 
> #!/usr/bin/python
> # -*- coding: utf-8 -*-
> import curses, sys
> 
> def init_display(stdscr):
>  stdscr.clear()
> stdscr.refresh()
> size = stdscr.getmaxyx()
>  y,x = size
> rootbox = stdscr.derwin(y, x, 0, 0)
> rootbox.box()
>  getmsgscrbox = rootbox.derwin(y-8, x-2, 1, 1)
> getmsgscrbox.box()
> getmsgscrbox.addstr( 0,2, "Pencere 1")
>  getmsgscrwin = getmsgscrbox.derwin(y-12, x-4, 1, 1)
> message = "Test: İıŞşğĞöÖ  わたし     ***Çıkmak için q ya basın."
>  getmsgscrwin.addstr( 1,1, message)
> rootbox.syncup()
> return rootbox
> 
> def main(stdscr):
> rootbox = init_display(stdscr)
> while 1:
>  input = rootbox.getch()
> if ( input == curses.KEY_RESIZE):
> init_display(stdscr)
>  elif input == ord("q"):
> sys.exit()
> rootbox.refresh()
> 
> curses.wrapper(main)


-- 
 Onur Küçük                                      Knowledge speaks,
 <onur.--.-.delipenguen.net>                     but wisdom listens

_______________________________________________
Linux-programlama mailing list
[email protected]
http://liste.linux.org.tr/mailman/listinfo/linux-programlama
Liste kurallari: http://liste.linux.org.tr/kurallar.php

Cevap