Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin3!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'output': 0.05; '"""': 0.07; 'column': 0.07; 'error:': 0.07; 'mouse': 0.07; 'tkinter': 0.07; '(those': 0.09; 'encode': 0.09; 'framework.': 0.09; 'idea?': 0.09; 'key.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'screen.': 0.09; 'subject:characters': 0.09; 'python': 0.11; 'jan': 0.12; 'random': 0.14; 'windows': 0.15; '6:52': 0.16; ';-)).': 0.16; 'accesses': 0.16; 'codec': 0.16; 'displaying': 0.16; 'editor,': 0.16; 'emulates': 0.16; 'menu.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'regression': 0.16; 'reversing': 0.16; 'rewritten': 0.16; 'screen,': 0.16; 'subject:Unicode': 0.16; 'wrote:': 0.18; 'looked': 0.18; 'trying': 0.19; 'widget': 0.19; 'written': 0.21; '>>>': 0.22; 'appears': 0.22; 'programming': 0.22; 'issue.': 0.22; 'separate': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'driver': 0.24; 'subject:problem': 0.24; 'text,': 0.24; 'unicode': 0.24; 'fairly': 0.24; 'order.': 0.26; 'recognized': 0.26; 'skip:" 30': 0.26; 'this:': 0.26; 'least': 0.26; '(for': 0.26; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'character': 0.29; 'characters': 0.30; 'moved': 0.30; "i'm": 0.30; 'lines': 0.31; 'apparently': 0.31; 'changed.': 0.31; 'subject:some': 0.31; 'file': 0.32; 'this.': 0.32; 'run': 0.32; 'text': 0.33; 'running': 0.33; '(most': 0.33; 'framework': 0.33; 'actual': 0.34; 'screen': 0.34; 'could': 0.34; 'subject:with': 0.35; "can't": 0.35; 'problem.': 0.35; 'something': 0.35; 'but': 0.35; 'there': 0.35; 'version': 0.36; '14,': 0.36; 'idle': 0.36; 'version:': 0.36; 'next': 0.36; 'possible': 0.36; 'hi,': 0.36; 'should': 0.36; 'turn': 0.37; 'two': 0.37; 'problems': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'track': 0.38; 'recent': 0.39; 'received:71': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'received:org': 0.40; 'how': 0.40; 'skip:u 10': 0.60; 'skip:c 50': 0.60; 'worry': 0.60; 'most': 0.60; 'black': 0.61; 'making': 0.63; 'real': 0.63; 'production': 0.68; 'normal.': 0.68; 'url:v': 0.71; 'url:youtube': 0.71; '8bit%:100': 0.72; 'construction': 0.72; 'serial': 0.72; 'click': 0.77; 'url:watch': 0.77; 'restore': 0.78; 'boxes.': 0.84; 'characters,': 0.84; 'detecting': 0.84; 'exercise,': 0.84; 'fonts': 0.84; 'hugh': 0.84; 'popup': 0.84; 'received:fios.verizon.net': 0.84; 'them)': 0.84; '\xe2\x94\x82': 0.84; 'boxes': 0.91; 'shell,': 0.91; 'skip:\xe2 30': 0.91; 'skip:\xe2 40': 0.91; 'thing,': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: cmd.exe on WIndows - problem with displaying some Unicode characters Date: Mon, 04 Aug 2014 04:39:36 -0400 References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Gmane-NNTP-Posting-Host: pool-71-175-90-87.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 101 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1407141602 news.xs4all.nl 2855 [2001:888:2000:d::a6]:49600 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:75670 On 8/3/2014 6:52 PM, Wiktor wrote: > > Hi, > > as OO programming exercise, I'm trying to port to Python one of my favo= rite > game from early'90 (Atari 65XL/XE) - Kolony (here's video from original= > version on C64 https://www.youtube.com/watch?v=3DUFycYOp2cbE, and here'= s This appears to be an actual text screen, no graphics. > video from modern rewritten (for Atari emulators) version: Kolony 2106 > https://www.youtube.com/watch?v=3DeX20Qqqm5eg - you get the idea? ;-)).= This appears to be text boxes on a graphics screen. > OO Design is one thing, but I want to make it look as near as possible = to > the original (those windows-like menus in console window). Which original? the C64 or Atari. The important characteristic of both=20 is that both have multiple overlapping popup boxes. This means that=20 either you or a widget framework much keep track of stacking order and=20 how to restore what was hidden when a box goes away or is moved down in=20 the stacking order. I would not be surprised if the Atari had at least a = rudimentary widget framework. > I tried to use > 'standard' Unicode characters (I can see that most of my Windows monosp= aced > fonts have them) to draw frame around menu. Something like this: > > =E2=94=8C=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=95=96= > =E2=94=82 Construction =E2=95=91 > =E2=94=82 Production =E2=95=91 > =E2=94=82 Research =E2=95=91 > =E2=94=82 Exploration =E2=95=91 > =E2=94=9C=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7= =C2=B7=C2=B7=C2=B7=C2=B7=E2=95=A2 > =E2=94=82 Next turn =E2=95=91 > =E2=95=98=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95= =90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=9D= > > (I like the look of double lines on right and at the bottom) > But when I try to print those characters, I get an error: > > | Traceback (most recent call last): > | File "E:\Moje dokumenty\python\kolony\menu.py", line 14, in > | """ > | File "C:\Python34\lib\encodings\cp852.py", line 19, in encode > | return codecs.charmap_encode(input,self.errors,encoding_map)[0] > | UnicodeEncodeError: 'charmap' codec can't encode character '\u2556' i= n position 1 > | 6: character maps to You have two separate problems with running in the windows console. 1. The character issue. If you run a program to just print the above=20 from an Idle editor, so that the output is printed to the Idle shell,=20 there should be no problem. >>> print('\u2556'*10) =E2=95=96=E2=95=96=E2=95=96=E2=95=96=E2=95=96=E2=95=96=E2=95=96=E2=95=96=E2= =95=96=E2=95=96 But characters are not your real issue. 2. The random access issue. The MS console in normal use is like a=20 serial printer or terminal. Once a line is printed, it cannot be=20 changed. I looked at the video and the program randomly accesses a 24 or = 25 line x 80 column screen, overprinting existing characters at will and = reversing black on white versus white of black at will. MSDOS screens=20 recognized standard ANSI screen control codes once the ANSI.SYS driver=20 was installed, which was fairly normal. But cmd.exe is actually a=20 regression from MS-DOS in that it apparently will not allow this. Or it = is a hugh pain. You could get a program that emulates a full-screen ANSI terminal, and=20 learn to use ANSI control codes. Or you could use a tkinter (tk) Text=20 widget. People have written at least serial terminal emulators for Text, = but I did not find a full-screen. Using tkinter, I would try making each box a separate text box placed in = a frameand let tkinter worry about displaying them correctly and=20 detecting which box get a mouse click or key. --=20 Terry Jan Reedy