323 lines
18 KiB
HTML
323 lines
18 KiB
HTML
|
||
<!DOCTYPE html>
|
||
|
||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<title>pylib.tui module — pylib 2019.12.21 documentation</title>
|
||
<link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
|
||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||
<link rel="stylesheet" href="_static/custom.css" type="text/css" />
|
||
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
|
||
<script type="text/javascript" src="_static/jquery.js"></script>
|
||
<script type="text/javascript" src="_static/underscore.js"></script>
|
||
<script type="text/javascript" src="_static/doctools.js"></script>
|
||
<script type="text/javascript" src="_static/language_data.js"></script>
|
||
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
|
||
<link rel="index" title="Index" href="genindex.html" />
|
||
<link rel="search" title="Search" href="search.html" />
|
||
<link rel="prev" title="pylib.time_of_day module" href="pylib.time_of_day.html" />
|
||
|
||
<link rel="stylesheet" href="_static/custom.css" type="text/css" />
|
||
|
||
|
||
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
|
||
|
||
</head><body>
|
||
|
||
|
||
<div class="document">
|
||
<div class="documentwrapper">
|
||
<div class="bodywrapper">
|
||
|
||
|
||
<div class="body" role="main">
|
||
|
||
<div class="section" id="module-pylib.tui">
|
||
<span id="pylib-tui-module"></span><h1>pylib.tui module<a class="headerlink" href="#module-pylib.tui" title="Permalink to this headline">¶</a></h1>
|
||
<p>TUI module.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Date</dt>
|
||
<dd class="field-odd"><p>2020-01-13</p>
|
||
</dd>
|
||
</dl>
|
||
<span class="target" id="module-tui"></span><dl class="class">
|
||
<dt id="pylib.tui.App">
|
||
<em class="property">class </em><code class="sig-name descname">App</code><span class="sig-paren">(</span><em class="sig-param">delay=5</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/tui.html#App"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.tui.App" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
|
||
<p>TUI text-based user interface</p>
|
||
<p>initscr is the encapsulation window object of the stdscr
|
||
stdsc is the curses.initscr</p>
|
||
<dl class="method">
|
||
<dt id="pylib.tui.App.clear">
|
||
<code class="sig-name descname">clear</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/tui.html#App.clear"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.tui.App.clear" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.tui.App.color_def">
|
||
<code class="sig-name descname">color_def</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/tui.html#App.color_def"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.tui.App.color_def" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.tui.App.color_table">
|
||
<code class="sig-name descname">color_table</code><span class="sig-paren">(</span><em class="sig-param">window=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/tui.html#App.color_table"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.tui.App.color_table" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Print all available colors with default background.
|
||
Check if curses.has_colors() is True.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.tui.App.end">
|
||
<code class="sig-name descname">end</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/tui.html#App.end"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.tui.App.end" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>clean up</p>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.tui.App.getch">
|
||
<code class="sig-name descname">getch</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/tui.html#App.getch"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.tui.App.getch" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.tui.App.main_loop">
|
||
<code class="sig-name descname">main_loop</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/tui.html#App.main_loop"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.tui.App.main_loop" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.tui.App.refresh">
|
||
<code class="sig-name descname">refresh</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/tui.html#App.refresh"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.tui.App.refresh" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="class">
|
||
<dt id="pylib.tui.StdOutWrapper">
|
||
<em class="property">class </em><code class="sig-name descname">StdOutWrapper</code><a class="reference internal" href="_modules/pylib/tui.html#StdOutWrapper"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.tui.StdOutWrapper" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
|
||
<p>Send print to stdout (print to the standard console).</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Example</dt>
|
||
<dd class="field-odd"><p></p></dd>
|
||
</dl>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># catch all prints into StdOutWrapper</span>
|
||
<span class="k">with</span> <span class="n">StdOutWrapper</span><span class="p">()</span> <span class="k">as</span> <span class="n">mystdout</span><span class="p">:</span>
|
||
|
||
<span class="c1"># begin curses (curses.initscr(), ...)</span>
|
||
|
||
<span class="c1"># do your stuff here</span>
|
||
<span class="c1"># print("foo")</span>
|
||
<span class="c1"># you can also output mystdout.get_text() in a ncurses widget in</span>
|
||
<span class="c1"># runtime</span>
|
||
|
||
<span class="c1"># end curses (curses.endwin())</span>
|
||
|
||
<span class="c1"># go back to normal state and print all catched prints to stdout</span>
|
||
</pre></div>
|
||
</div>
|
||
<dl class="method">
|
||
<dt id="pylib.tui.StdOutWrapper.get_text">
|
||
<code class="sig-name descname">get_text</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/tui.html#StdOutWrapper.get_text"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.tui.StdOutWrapper.get_text" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.tui.StdOutWrapper.write">
|
||
<code class="sig-name descname">write</code><span class="sig-paren">(</span><em class="sig-param">txt</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/tui.html#StdOutWrapper.write"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.tui.StdOutWrapper.write" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>print uses write()</p>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="class">
|
||
<dt id="pylib.tui.Window">
|
||
<em class="property">class </em><code class="sig-name descname">Window</code><a class="reference internal" href="_modules/pylib/tui.html#Window"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.tui.Window" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
|
||
<dl class="method">
|
||
<dt id="pylib.tui.Window.border">
|
||
<code class="sig-name descname">border</code><span class="sig-paren">(</span><em class="sig-param">title=''</em>, <em class="sig-param">footer_left=''</em>, <em class="sig-param">footer_right=''</em>, <em class="sig-param">style='horizontal'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/tui.html#Window.border"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.tui.Window.border" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Set border around the window with optional title and footer
|
||
labels.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>window</strong> (<em>curses.window</em>) – the window to draw a border</p></li>
|
||
<li><p><strong>title</strong> (<em>str</em>) – the title for the window (default = “”)</p></li>
|
||
<li><p><strong>footer_left</strong> (<em>str</em><em> or </em><em>list</em>) – the footer label (default = “”). If footer_left
|
||
is a list than every element of the list will be printed sperated
|
||
by one column. This is useful to not overwright the border with a
|
||
space character.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.tui.Window.clear">
|
||
<code class="sig-name descname">clear</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/tui.html#Window.clear"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.tui.Window.clear" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.tui.Window.derwin">
|
||
<code class="sig-name descname">derwin</code><span class="sig-paren">(</span><em class="sig-param">height</em>, <em class="sig-param">width</em>, <em class="sig-param">y</em>, <em class="sig-param">x</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/tui.html#Window.derwin"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.tui.Window.derwin" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.tui.Window.getch">
|
||
<code class="sig-name descname">getch</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/tui.html#Window.getch"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.tui.Window.getch" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.tui.Window.getmaxyx">
|
||
<code class="sig-name descname">getmaxyx</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/tui.html#Window.getmaxyx"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.tui.Window.getmaxyx" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.tui.Window.initscr">
|
||
<code class="sig-name descname">initscr</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/tui.html#Window.initscr"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.tui.Window.initscr" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.tui.Window.instr">
|
||
<code class="sig-name descname">instr</code><span class="sig-paren">(</span><em class="sig-param">y</em>, <em class="sig-param">x</em>, <em class="sig-param">n</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/tui.html#Window.instr"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.tui.Window.instr" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.tui.Window.refresh">
|
||
<code class="sig-name descname">refresh</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/tui.html#Window.refresh"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.tui.Window.refresh" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.tui.Window.text">
|
||
<code class="sig-name descname">text</code><span class="sig-paren">(</span><em class="sig-param">string</em>, <em class="sig-param">padding_left=0</em>, <em class="sig-param">padding_top=0</em>, <em class="sig-param">attribute=0</em>, <em class="sig-param">color_pair=0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/tui.html#Window.text"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.tui.Window.text" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Test to screen. If multiline than keep the x position for
|
||
each new line.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Example</dt>
|
||
<dd class="field-odd"><p></p></dd>
|
||
</dl>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">text</span><span class="p">(</span><span class="n">stdscr</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="s2">"1 - Show test page"</span><span class="p">)</span>
|
||
<span class="n">text</span><span class="p">(</span><span class="n">stdscr</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="s2">"h - Show help page"</span><span class="p">)</span>
|
||
<span class="n">text</span><span class="p">(</span><span class="n">stdscr</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="s2">"q - Exit"</span><span class="p">)</span>
|
||
|
||
<span class="n">text</span><span class="p">(</span><span class="n">stdscr</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span>
|
||
<span class="s2">"1 - Show test page</span><span class="se">\\</span><span class="s2">n"</span> <span class="o">+</span>
|
||
<span class="s2">"h - Show help page</span><span class="se">\\</span><span class="s2">n"</span> <span class="o">+</span>
|
||
<span class="s2">"q - Exit"</span><span class="p">)</span>
|
||
</pre></div>
|
||
</div>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>Writing in the last char of the window (last row bottom and
|
||
last column right) is suppressed</p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.tui.Window.textbox">
|
||
<code class="sig-name descname">textbox</code><span class="sig-paren">(</span><em class="sig-param">height</em>, <em class="sig-param">width</em>, <em class="sig-param">y</em>, <em class="sig-param">x</em>, <em class="sig-param">borders=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/tui.html#Window.textbox"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.tui.Window.textbox" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Add sub window.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>parent_window</strong> (<em>curses.window</em>) – the parent window</p></li>
|
||
<li><p><strong>height</strong> (<em>int</em>) – the height of the sub window. The reference point of
|
||
the sub window is the top left corner.</p></li>
|
||
<li><p><strong>width</strong> (<em>int</em>) – the width of the sub window. The reference point of
|
||
the sub window is the top left corner.</p></li>
|
||
<li><p><strong>y</strong> (<em>int</em>) – the y coordinate (position) of the sub window. Start from
|
||
the top.</p></li>
|
||
<li><p><strong>x</strong> – the x coordinate (position) of the sub window. Start from
|
||
the left.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>the sub window content and decoration</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>(curses.window, curses.window)</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.tui.newwin">
|
||
<code class="sig-name descname">newwin</code><span class="sig-paren">(</span><em class="sig-param">height</em>, <em class="sig-param">width</em>, <em class="sig-param">y</em>, <em class="sig-param">x</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/tui.html#newwin"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.tui.newwin" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
</div>
|
||
|
||
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
||
<div class="sphinxsidebarwrapper">
|
||
<h1 class="logo"><a href="index.html">pylib</a></h1>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<h3>Navigation</h3>
|
||
<p class="caption"><span class="caption-text">Contents:</span></p>
|
||
<ul class="current">
|
||
<li class="toctree-l1 current"><a class="reference internal" href="modules.html">pylib</a><ul class="current">
|
||
<li class="toctree-l2 current"><a class="reference internal" href="pylib.html">pylib package</a></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
|
||
<div class="relations">
|
||
<h3>Related Topics</h3>
|
||
<ul>
|
||
<li><a href="index.html">Documentation overview</a><ul>
|
||
<li><a href="modules.html">pylib</a><ul>
|
||
<li><a href="pylib.html">pylib package</a><ul>
|
||
<li>Previous: <a href="pylib.time_of_day.html" title="previous chapter">pylib.time_of_day module</a></li>
|
||
</ul></li>
|
||
</ul></li>
|
||
</ul></li>
|
||
</ul>
|
||
</div>
|
||
<div id="searchbox" style="display: none" role="search">
|
||
<h3 id="searchlabel">Quick search</h3>
|
||
<div class="searchformwrapper">
|
||
<form class="search" action="search.html" method="get">
|
||
<input type="text" name="q" aria-labelledby="searchlabel" />
|
||
<input type="submit" value="Go" />
|
||
</form>
|
||
</div>
|
||
</div>
|
||
<script type="text/javascript">$('#searchbox').show(0);</script>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="clearer"></div>
|
||
</div>
|
||
<div class="footer">
|
||
©2019, Daniel Weschke.
|
||
|
||
|
|
||
Powered by <a href="http://sphinx-doc.org/">Sphinx 2.2.1</a>
|
||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
||
|
||
|
|
||
<a href="_sources/pylib.tui.rst.txt"
|
||
rel="nofollow">Page source</a>
|
||
</div>
|
||
|
||
|
||
|
||
|
||
</body>
|
||
</html> |