<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#330033">
    <div class="moz-cite-prefix">On 8/4/2014 1:39 AM, Terry Reedy wrote:<br>
    </div>
    <blockquote cite="mid:lrngsi$bti$1@ger.gmane.org" type="cite">On
      8/3/2014 6:52 PM, Wiktor wrote:
      <br>
      <blockquote type="cite">
        <br>
        Hi,
        <br>
        <br>
        as OO programming exercise, I'm trying to port to Python one of
        my favorite
        <br>
        game from early'90 (Atari 65XL/XE) - Kolony (here's video from
        original
        <br>
        version on C64 <a class="moz-txt-link-freetext" href="https://www.youtube.com/watch?v=UFycYOp2cbE">https://www.youtube.com/watch?v=UFycYOp2cbE</a>, and
        here's
        <br>
      </blockquote>
      <br>
      This appears to be an actual text screen, no graphics.
      <br>
      <br>
      <blockquote type="cite">video from modern rewritten (for Atari
        emulators) version: Kolony 2106
        <br>
        <a class="moz-txt-link-freetext" href="https://www.youtube.com/watch?v=eX20Qqqm5eg">https://www.youtube.com/watch?v=eX20Qqqm5eg</a> - you get the idea?
        ;-)).
        <br>
      </blockquote>
      <br>
      This appears to be text boxes on a graphics screen.
      <br>
      <br>
      <blockquote type="cite">OO Design is one thing, but I want to make
        it look as near as possible to
        <br>
        the original (those windows-like menus in console window).
        <br>
      </blockquote>
      <br>
      Which original? the C64 or Atari.  The important characteristic of
      both is that both have multiple overlapping popup boxes. This
      means that either you or a widget framework much keep track of
      stacking order and how to restore what was hidden when a box goes
      away or is moved down in the stacking order. I would not be
      surprised if the Atari had at least a rudimentary widget
      framework.
      <br>
      <br>
      > I tried to use
      <br>
      <blockquote type="cite">'standard' Unicode characters (I can see
        that most of my Windows monospaced
        <br>
        fonts have them) to draw frame around menu. Something like this:
        <br>
        <br>
          ┌──────────────╖
        <br>
          │ Construction ║
        <br>
          │ Production   ║
        <br>
          │ Research     ║
        <br>
          │ Exploration  ║
        <br>
          ├··············╢
        <br>
          │ Next turn    ║
        <br>
          ╘══════════════╝
        <br>
        <br>
        (I like the look of double lines on right and at the bottom)
        <br>
        But when I try to print those characters, I get an error:
        <br>
        <br>
        | Traceback (most recent call last):
        <br>
        |   File "E:\Moje dokumenty\python\kolony\menu.py", line 14, in
        <module>
        <br>
        |     """
        <br>
        |   File "C:\Python34\lib\encodings\cp852.py", line 19, in
        encode
        <br>
        |     return
        codecs.charmap_encode(input,self.errors,encoding_map)[0]
        <br>
        | UnicodeEncodeError: 'charmap' codec can't encode character
        '\u2556' in position 1
        <br>
        | 6: character maps to <undefined>
        <br>
      </blockquote>
      <br>
      You have two separate problems with running in the windows
      console.
      <br>
      <br>
      1. The character issue. If you run a program to just print the
      above from an Idle editor, so that the output is printed to the
      Idle shell, there should be no problem.
      <br>
      >>> print('\u2556'*10)
      <br>
      ╖╖╖╖╖╖╖╖╖╖
      <br>
      But characters are not your real issue.
      <br>
      <br>
      2. The random access issue. The MS console in normal use is like a
      serial printer or terminal. Once a line is printed, it cannot be
      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 recognized standard ANSI screen control codes
      once the ANSI.SYS driver was installed, which was fairly normal.
      But cmd.exe is actually a regression from MS-DOS in that it
      apparently will not allow this.  Or it is a hugh pain.
      <br>
      <br>
      You could get a program that emulates a full-screen ANSI terminal,
      and learn to use ANSI control codes.  Or you could use a tkinter
      (tk) Text widget. People have written at least serial terminal
      emulators for Text, but I did not find a full-screen.
      <br>
      <br>
      Using tkinter, I would try making each box a separate text box
      placed in a frameand let tkinter worry about displaying them
      correctly and detecting which box get a mouse click or
      <enter> key.
      <br>
      <br>
    </blockquote>
    I've never used the API from Python but random console access is
    documented at
<a class="moz-txt-link-freetext" href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms687404%28v=vs.85%29.aspx">http://msdn.microsoft.com/en-us/library/windows/desktop/ms687404%28v=vs.85%29.aspx</a><br>
  </body>
</html>