Pharo 5の初心者として、私はデジタル時計を世界または/および窓で「12:25:05」と表示する方法を見つけることができません。 PharoにはClockMorphはありませんか?Pharoにデジタル時計を表示するには?キュイ?
私は欲しいものを手に入れます!それは素晴らしいことだ:
|morph|
morph := StringMorph new.
morph font: (LogicalFont familyName: 'Source Sans Pro' pointSize: 20).
morph color: Color gray.
morph openInWorld; bounds: ((World bounds corner x)[email protected] extent: [email protected]).
[ [ true ] whileTrue: [
morph contents: Time now print24.
1 second wait
] ] fork.
Morphicとウィンドウ内のクロック用:
|morph myWindow|
myWindow := StandardWindow labelled: 'CLOCK'.
myWindow addMorph:(morph := StringMorph new) frame: ([email protected](-0.2) corner: [email protected]).
myWindow beUnresizeable ; removeCloseBox ; removeCollapseBox ;
removeExpandBox ; removeMenuBox.
"meta-click to activate the ""morphic halo"" and close window"
morph font: (LogicalFont familyName: 'Source Sans Pro' pointSize: 20).
morph color: Color white.
myWindow openInWorld; bounds: ((World bounds corner x)[email protected] extent: [email protected]).
[ [ true ] whileTrue: [
morph contents: Time now print24.
1 second wait
] ] fork.
スペックを持つウィンドウ内のクロックの世界におけるクロックの
:
| view labelClock layout | " Configure the Spec models " view := DynamicComposableModel new instantiateModels: #(labelClock ButtonModel); extent: [email protected]; title: 'CLOCK' yourself. " Configure the Spec layout " layout := SpecLayout composed newColumn: [ : r | r add: #labelClock]; yourself. " Set up the widgets " view labelClock font: (LogicalFont familyName: 'Source Sans Pro' pointSize: 20). [ [ true ] whileTrue: [ view labelClock label: Time now print24. 1 second wait ] ] fork. " Open the Window " (view openWithSpecLayout: layout) centered; modalRelativeTo: World.
ありがとうございました@Peter、@Bert、@aka。 Cuisでモーフでクロックの
:
|morph string| morph := LayoutMorph newRow. morph morphPosition:(Display width -160)@10 extent:[email protected]; color:Color skyBlue; padding:#center. string := StringMorph new. string font: (AbstractFont familyName: 'DejaVu' pointSize: 22). [ [ true ] whileTrue: [ string contents: Time now print24. (Delay forSeconds:1) wait ] ] fork. morph addMorph: string. morph openInWorld.
しかし、モーフがある項目で「UpdatingStringMorph」と呼ばれる「新しいモーフ...」Cuisの時間を示して世界のメニューに!
ありがとう@Stephan。ポモドーロは上手く見える。 –