11 def __init__( self, parent, width, height ):
12 TGMainFrame.__init__( self, parent, width, height )
15 self.fExit =
TGTextButton( self.fHor1,
"&Exit",
"gApplication->Terminate(0)" )
16 self.fExit.SetCommand(
'TPython::Exec( "raise SystemExit" )' )
17 self.fHor1.AddFrame( self.fExit,
TGLayoutHints( kLHintsTop | kLHintsLeft |
18 kLHintsExpandX, 4, 4, 4, 4 ) )
19 self.AddFrame( self.fHor1,
TGLayoutHints( kLHintsBottom | kLHintsRight, 2, 2, 5, 1 ) )
21 self.fNumber =
TGNumberEntry( self, 0, 9,999, TGNumberFormat.kNESInteger,
22 TGNumberFormat.kNEANonNegative,
23 TGNumberFormat.kNELLimitMinMax,
27 "ValueSet(Long_t)",
"TPyDispatcher", self.fLabelDispatch,
"Dispatch()" )
28 self.fNumber.GetNumberEntry().Connect(
29 "ReturnPressed()",
"TPyDispatcher", self.fLabelDispatch,
"Dispatch()" )
30 self.AddFrame( self.fNumber,
TGLayoutHints( kLHintsTop | kLHintsLeft, 5, 5, 5, 5 ) )
32 self.fLabel =
TGLabel( self.fGframe,
"No input." )
33 self.fGframe.AddFrame( self.fLabel,
TGLayoutHints( kLHintsTop | kLHintsLeft, 5, 5, 5, 5) )
34 self.AddFrame( self.fGframe,
TGLayoutHints( kLHintsExpandX, 2, 2, 1, 1 ) )
36 self.SetCleanup( kDeepCleanup )
37 self.SetWindowName(
"Number Entry" )
39 self.Resize( self.GetDefaultSize() )
45 def DoSetlabel( self ):
46 self.fLabel.SetText(
Form(
"%d" % self.fNumber.GetNumberEntry().GetIntNumber() ) )
50 if __name__ ==
'__main__':
51 window = pMyMainFrame( gClient.GetRoot(), 50, 50 )
char * Form(const char *fmt,...)
RooCmdArg Layout(Double_t xmin, Double_t xmax=0.99, Double_t ymin=0.95)