非常教程

Python参考手册

SGI IRIX

fl

自2.6版弃用:fl模块已在Python 3中删除。

该模块通过Mark Overmars为FORMS库提供了一个接口。 该库的源可以通过匿名FTP从主机ftp.cs.ruu.nl,目录SGI / FORMS中检索。 最后在版本2.0b中进行了测试。

大多数函数都是C等效的直接翻译,从名称中删除最初的fl_。 库使用的常量在下面描述的模块FL中定义。

Python中的对象的创建与C中的稍有不同:而不是由添加了新FORMS对象的库维护的“当前表单”,将FORMS对象添加到表单的所有函数都是Python对象的方法 表格。 因此,C函数fl_addto_form()和fl_end_form()没有Python等价物,而fl_bgn_form()的等价物称为fl.make_form()。

注意有些令人困惑的术语:FORMS使用单词对象来表示按钮,滑块等,您可以将它们放置在表单中。在Python中,'object'意味着任何值。FORMS的Python接口引入了两种新的Python对象类型:表单对象(表示整个表单)和FORMS对象(表示一个按钮,滑块等)。希望这不是太混乱。

在FORMS的Python接口中没有“自由对象”,也没有简单的方法来添加用Python编写的对象类。尽管可以使用FOR事件处理的FORMS接口,所以可以将FORMS与纯GL窗口混合使用。

请注意:导入fl意味着调用GL函数foreground()和FORMS例程fl_init()。

1.模块fl中定义的功能

模块fl定义了以下功能。有关它们所做的更多信息,请参阅FORMS文档中对等效C函数的描述:

fl.make_form(type, width, height)

创建一个给定类型,宽度和高度的表单。这将返回一个表单对象,其方法如下所述。

fl.do_forms()

标准的FORMS主循环。 返回表示需要交互的FORMS对象的Python对象,或者特殊值FL.EVENT。

fl.check_forms()

检查FORMS事件。 返回上面返回的do_forms()返回值,如果没有立即需要交互的事件返回None。

fl.set_event_call_back(function)

设置事件回调函数。

fl.set_graphics_mode(rgbmode, doublebuffering)

设置图形模式。

fl.get_rgbmode()

返回当前的rgb模式。 这是C全局变量fl_rgbmode的值。

fl.show_message(str1, str2, str3)

显示一个带有三行消息和一个OK按钮的对话框。

fl.show_question(str1, str2, str3)

显示一个带有三行消息和YES和NO按钮的对话框。 如果用户按下“是”,则返回1,否则返回“0”。

fl.show_choice(str1, str2, str3, but1[, but2[, but3]])

显示一个带有三行消息和最多三个按钮的对话框。它返回用户(点击的按钮的数目为123)。

fl.show_input(prompt, default)

显示一个对话框,其中包含单行提示消息和用户可输入字符串的文本字段。第二个参数是默认的输入字符串。它返回用户编辑的字符串值。

fl.show_file_selector(message, directory, pattern, default)

显示一个用户可以选择文件的对话框。 它返回用户选择的绝对文件名,如果用户按下取消则返回None。

fl.get_directory()fl.get_pattern()fl.get_filename()

这些函数返回用户在上一次show_file_selector()调用中选择的目录,模式和文件名(仅限尾部)。

fl.qdevice(dev)fl.unqdevice(dev)fl.isqueued(dev)fl.qtest()fl.qread()fl.qreset()fl.qenter(dev, val)fl.get_mouse()fl.tie(button, valuator1, valuator2)

这些功能是FORMS与相应GL功能的接口。 如果您想在使用fl.do_events()时自己处理一些GL事件,请使用这些参数。 当检测到FORMS无法处理的GL事件时,fl.do_forms()返回特殊值FL.EVENT,您应该调用fl.qread()从队列中读取事件。 不要使用等效的GL功能!

fl.color()fl.mapcolor()fl.getmcolor()

请参阅fl_color(),fl_mapcolor()和fl_getmcolor()的FORMS文档中的说明。

2.表单对象

表单对象(由上面的make_form()返回)具有以下方法。 每个方法对应一个C函数,其名称前缀为fl_; 并且其第一个参数是一个表单指针; 请参阅官方FORMS文件的说明。

所有的add_*()方法都会返回一个代表FORMS对象的Python对象。下面描述FORMS对象的方法。大多数FORMS对象也有一些特定的方法; 这些方法在这里列出。

form.show_form(placement, bordertype, name)

显示表单。

form.hide_form()

隐藏表单。

form.redraw_form()

重新绘制表单。

form.set_form_position(x, y)

设置表单的位置。

form.freeze_form()

冻结表格。

form.unfreeze_form()

取消冻结表单。

form.activate_form()

激活表单。

form.deactivate_form()

取消激活表单。

form.bgn_group()

开始一组新的对象; 返回一个组对象。

form.end_group()

结束当前的一组对象。

form.find_first()

找到表单中的第一个对象。

form.find_last()

找到表单中的最后一个对象。

form.add_box(type, x, y, w, h, name)

将一个框对象添加到窗体。没有额外的方法。

form.add_text(type, x, y, w, h, name)

将文本对象添加到窗体。没有额外的方法。

form.add_clock(type, x, y, w, h, name)

将时钟对象添加到窗体。- 方法:get_clock()

form.add_button(type, x, y, w, h, name)

将一个按钮对象添加到窗体。-方法:get_button()set_button()

form.add_lightbutton(type, x, y, w, h, name)

向表单添加一个按钮对象。-方法:get_button()set_button()

form.add_roundbutton(type, x, y, w, h, name)

向表单添加一个圆形按钮对象。-方法:get_button()set_button()

form.add_slider(type, x, y, w, h, name)

将一个滑块对象添加到窗体。-方法:set_slider_value()get_slider_value()set_slider_bounds()get_slider_bounds()set_slider_return()set_slider_size()set_slider_precision()set_slider_step()

form.add_valslider(type, x, y, w, h, name)

将valslider对象添加到窗体。-方法:set_slider_value()get_slider_value()set_slider_bounds()get_slider_bounds()set_slider_return()set_slider_size()set_slider_precision()set_slider_step()

form.add_dial(type, x, y, w, h, name)

将拨号对象添加到表单。-方法:set_dial_value()get_dial_value()set_dial_bounds()get_dial_bounds()

form.add_positioner(type, x, y, w, h, name)

将定位器对象添加到表单。-方法:set_positioner_xvalue()set_positioner_yvalue()set_positioner_xbounds()set_positioner_ybounds()get_positioner_xvalue()get_positioner_yvalue()get_positioner_xbounds()get_positioner_ybounds()

form.add_counter(type, x, y, w, h, name)

将一个计数器对象添加到窗体。-方法:set_counter_value()get_counter_value()set_counter_bounds()set_counter_step()set_counter_precision()set_counter_return()

form.add_input(type, x, y, w, h, name)

将输入对象添加到窗体。-方法:set_input()get_input()set_input_color()set_input_return()

form.add_menu(type, x, y, w, h, name)

将一个菜单对象添加到窗体。-方法:set_menu()get_menu()addto_menu()

form.add_choice(type, x, y, w, h, name)

将选择对象添加到表单。-方法:set_choice()get_choice()clear_choice()addto_choice()replace_choice()delete_choice()get_choice_text()set_choice_fontsize()set_choice_fontstyle()

form.add_browser(type, x, y, w, h, name)

将一个浏览器对象添加到窗体。-方法:set_browser_topline()clear_browser()add_browser_line()addto_browser()insert_browser_line()delete_browser_line()replace_browser_line()get_browser_line()load_browser()get_browser_maxline()select_browser_line()deselect_browser_line()deselect_browser()isselected_browser_line()get_browser()set_browser_fontsize()set_browser_fontstyle()set_browser_specialkey()

form.add_timer(type, x, y, w, h, name)

将一个计时器对象添加到窗体。-方法:set_timer()get_timer()

表单对象具有以下数据属性; 请参阅FORMS文档:

名称

C型

含义

window

int(只读)

GL窗口ID

w

float

形式宽度

h

float

形式高度

x

float

形式x起源

y

float

形成y起源

deactivated

INT

如果表单已停用,则为非零

visible

INT

如果窗体可见,则为非零值

frozen

INT

如果表格被冻结,则不为零

doublebuf

INT

非双缓冲

3.表单对象

除了特定类型的FORMS对象的特定方法外,所有FORMS对象还具有以下方法:

FORMS object.set_call_back(function, argument)

设置对象的回调函数和参数。 当对象需要交互时,将使用两个参数调用回调函数:对象和回调参数。 (没有回调函数的FORMS对象在需要交互时由fl.do_forms()或fl.check_forms()返回。)调用此方法而不带参数来移除回调函数。

FORMS object.delete_object()

删除对象。

FORMS object.show_object()

显示对象。

FORMS object.hide_object()

隐藏对象。

FORMS object.redraw_object()

重绘对象。

FORMS object.freeze_object()

冻结对象。

FORMS object.unfreeze_object()

解冻对象。

FORMS对象具有这些数据属性; 请参阅FORMS文档:

名称

C 类型

含义

objclass

int (read-only)

对象类

type

int (read-only)

对象类

boxtype

int

box 类

x

float

x 起源

y

float

y 起源

w

float

宽度

h

float

高度

col1

int

原色

col2

int

次要颜色

align

int

对准

lcol

int

标签色

lsize

float

标签字体大小

label

string

标签字符串

lstyle

int

标签类型

pushed

int (只读)

(参阅 FORMS 文档)

focus

int (只读)

(参阅 FORMS 文档)

belowmouse

int (只读)

(参阅 FORMS 文档)

frozen

int (只读)

(参阅 FORMS 文档)

active

int (只读)

(参阅 FORMS 文档)

input

int (只读)

(参阅 FORMS 文档)

visible

int (只读)

(参阅 FORMS 文档)

radio

int (只读)

(参阅 FORMS 文档)

automatic

int (只读)

(参阅 FORMS 文档)

自2.6版弃用:FL模块已在Python 3中删除。

该模块定义了使用内置模块fl所需的符号常量(参见上文); 它们与C头文件<forms.h>中定义的那些相同,只是省略了名称前缀FL_。 阅读模块源以获取定义名称的完整列表。 建议使用:

import fl
from FL import *

自2.6版以来已弃用:该flp模块已在Python 3中删除。

该模块定义了可读取由FORMS库附带的“表单设计器”(fdesign)程序创建的表单定义的函数(参见fl上面的模块)。

现在,请参阅flp.docPython库源目录中的文件以获取描述。

XXX应该在这里插入一个完整的描述!

SGI IRIX相关

Python

Python 是一种面向对象的解释型计算机程序设计语言,由荷兰人 Guido van Rossum 于1989年发明,第一个公开发行版发行于1991年。 Python 是纯粹的自由软件, 源代码和解释器 CPython 遵循 GPL 协议。Python 语法简洁清晰,特色之一是强制用空白符( white space )作为语句缩进。

主页 https://www.python.org/
源码 https://github.com/python/cpython
版本 2.7
发布版本 2.7.13

Python目录

1.内置常量 | Built-in Constants
2.内置例外 | Built-in Exceptions
3.内置函数 | Built-in Functions
4.内置类型 | Built-in Types
5.编译器 | Compiler
6.加密 | Cryptography
7.数据压缩 | Data Compression
8.数据持久性 | Data Persistence
9.数据类型 | Data Types
10.调试和分析 | Debugging & Profiling
11.开发工具 | Development Tools
12.文件和目录访问 | File & Directory Access
13.文件格式 | File Formats
14.构架 | Frameworks
15.输入 | Importing
16.输入/输出 | Input/ouput
17.国际化 | Internationalization
18.网络 | Internet
19.网络数据 | Internet Data
20.翻译 | Interpreters
21.语言 | Language
22.记录 | Logging
23.Mac OS
24.MS Windows
25.多媒体 | Multimedia
26.联网 | Networking
27.数字与数学 | Numeric & Mathematical
28.操作系统 | Operating System
29.可选操作系统 | Optional Operating System
30.限制执行 | Restricted Execution
31.运行 | Runtime
32.SGI IRIX
33.软件包装与分销 | Software Packaging & Distribution
34.字符串 | String
35.结构化标记 | Structured Markup
36.Tk
37.Unix
38.Python 简介
39.Python pass 语句
40.Python 循环嵌套
41.Python 运算符
42.Python log10() 函数
43.Python log() 函数
44.Python floor() 函数
45.Python fabs() 函数
46.Python exp() 函数
47.Python cmp() 函数
48.Python ceil() 函数
49.Python abs() 函数
50.Python Number(数字)
51.Python pow() 函数
52.Python modf() 函数
53.Python min() 函数
54.Python max() 函数
55.Python asin() 函数
56.Python acos() 函数
57.Python uniform() 函数
58.Python shuffle() 函数
59.Python seed() 函数
60.Python random() 函数
61.Python randrange() 函数
62.Python choice() 函数
63.Python sqrt() 函数
64.Python round() 函数
65.Python radians() 函数
66.Python degrees() 函数
67.Python tan() 函数
68.Python sin() 函数
69.Python hypot() 函数
70.Python cos() 函数
71.Python atan2() 函数
72.Python atan() 函数
73.Python 元组
74.Python 列表(List)
75.Python 字符串
76.Python 字典(Dictionary)
77.Python 日期和时间
78.Python 函数
79.Python 模块
80.Python capitalize()方法
81.Python center()方法
82.Python count() 方法
83.Python expandtabs()方法
84.Python endswith()方法
85.Python encode()方法
86.Python decode()方法
87.Python find()方法
88.Python index()方法
89.Python 异常处理
90.Python isspace()方法
91.Python isnumeric()方法
92.Python islower()方法
93.Python isdigit()方法
94.Python isalpha()方法
95.Python isalnum()方法
96.Python isupper()方法
97.Python istitle()方法
98.Python min()方法
99.Python max()方法
100.Python maketrans()方法