📄 calculator.pl
字号:
/********************************************************************
Constraint-based Graphical Programming in B-Prolog
%
draw a calculator keyboard
*********************************************************************/
go:-
Buttons=[B0,B1,B2,B3,B4,B5,B6,B7,B8,B9,Bc,Bdiv,Bmul,Bsub,Badd,Beq,Bdot],
cgButtons(Buttons),
B0^text #= '0',
B1^text #= '1',
B2^text #= '2',
B3^text #= '3',
B4^text #= '4',
B5^text #= '5',
B6^text #= '6',
B7^text #= '7',
B8^text #= '8',
B9^text #= '9',
%
Bc^text #= 'C',
Bdiv^text #= '/',
Bmul^text #= '*',
Bsub^text #= '-',
Badd^text #= '+',
Beq^text #= '=',
Bdot^text #= '.',
%
B0^fontSize #= 26,
B0^fontStyle #= 'BOLD',
B0^width #>50,
cgSameFont(Buttons),
cgGrid([[Bc,Bdiv,Bmul,Bsub],
[B7,B8, B9, Badd],
[B4,B5, B6, Badd],
[B1,B2, B3, Beq],
[B0,B0, Bdot,Beq]],2,2),
%
cgDefaultWindow(Win),Win^leftMargin #= 50, Win^topMargin #= 50,
cgStartRecord(calculator),
cgShow(Buttons),
cgStopRecord.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -