2

PyUIの使い方がわかる人がいたら教えてください。🙇‍♂️
http://pyui.sourceforge.net/

追記:

このサンプルコードのtestoptとはなんですか。
教えてください。

import testopt
import time
import pyui

def onbutton(self):
    print "got a button " 

def run():
    opts = testopt.parseCommandLine(800, 600)
    done = 1
    frame = 0
    t = time.time()
    pyui.init(*opts)
    w = pyui.widgets.Frame(50, 50, 400, 400, "clipme")
    b = pyui.widgets.Button( "A button is here", onbutton)
    w.addChild(b)
    w.pack()

    w.setBackImage("max.bmp")
    pyui.run()

    print "done"
    pyui.quit()


if __name__ == '__main__':
    run()

(コードの出典: http://pyui.sourceforge.net/ の Example Code)

0

1 件の回答 1

0

こんなのが見つかりました。書かれている説明からすると何か関連してそうです。
PySBD/testopt.py

"""Process command line arguments for pyui test programs
Command line options to this are:
    -w window/screen width
    -h window/screen height
    -f fullscreen flag (0 or 1)
    -r renderer ("dx" or other PyUI renderer)
"""

なお、testoptに関しては載っていないし中途半端ですがDocumentationがあるようです。

しかし最新リリース版が17年前/開発版?も類似時期(せいぜい+半年)で、対応版数もPython 2.1, PyGame 1.1 では知っている人は居ないか、今では役に立たないライブラリなのでは?


testoptに関しては呼び出した後、

opts = testopt.parseCommandLine(800, 600)

使われているのがこれなので、

pyui.init(*opts)

pyui.init()のパラメータを作っているということでしょうね。

Documentationの PyUI Basics Section の最初に以下の説明があり、3つ目/4つ目の順番が上記と逆ですが、上記のソースで戻り値の順番を見ると以下と同じであり、途中の処理で対処されているか、説明だけちょっとおかしいようです。

Initializing PyUI

PyUI programs must call the pyui.init() method to initialize PyUI. This method creates a renderer which created the main window, and sets up PyUI internals ready to run the program. It may also switch to full-screen mode if that was specified. The arguments to pyui.init() are:

width - the width of the main window in pixels
height - the height of the main window in pixels
renderer - the name of the renderer to use
fullscreen - a flag to specify whether to enter fullscreen mode

The renderers that come with PyUI are:

"null" - A null renderer that doesn't actually renderer anything
"2d" - PyGame two-dimensional renderer
"gl" - an OpenGL renderer implemented using PyOpenGL
"tk" - a Tk canvas renderer. (experimental)
"win32" - a win32 GDI renderer (experimental)

A "dx" Direct 3D renderer written in C++ also exists, but it is not included in the PyUI distribution.

For example, to initialize PyUI in fullscreen OpenGL mode at 640x480 resolution:

pyui.init(640, 480, "gl", 1)

この質問に回答するには、ログインする必要があります。