ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
numberEntry.py
Go to the documentation of this file.
1 from ROOT import *
2 
4  def __init__( self, parent, width, height ):
5  TGMainFrame.__init__( self, parent, width, height )
6 
7  self.fHor1 = TGHorizontalFrame( self, 60, 20, kFixedWidth )
8  self.fExit = TGTextButton( self.fHor1, "&Exit", "gApplication->Terminate(0)" )
9  self.fExit.SetCommand( 'TPython::Exec( "raise SystemExit" )' )
10  self.fHor1.AddFrame( self.fExit, TGLayoutHints( kLHintsTop | kLHintsLeft |
11  kLHintsExpandX, 4, 4, 4, 4 ) )
12  self.AddFrame( self.fHor1, TGLayoutHints( kLHintsBottom | kLHintsRight, 2, 2, 5, 1 ) )
13 
14  self.fNumber = TGNumberEntry( self, 0, 9,999, TGNumberFormat.kNESInteger,
15  TGNumberFormat.kNEANonNegative,
16  TGNumberFormat.kNELLimitMinMax,
17  0, 99999 )
19  self.fNumber.Connect(
20  "ValueSet(Long_t)", "TPyDispatcher", self.fLabelDispatch, "Dispatch()" )
21  self.fNumber.GetNumberEntry().Connect(
22  "ReturnPressed()", "TPyDispatcher", self.fLabelDispatch, "Dispatch()" )
23  self.AddFrame( self.fNumber, TGLayoutHints( kLHintsTop | kLHintsLeft, 5, 5, 5, 5 ) )
24  self.fGframe = TGGroupFrame( self, "Value" )
25  self.fLabel = TGLabel( self.fGframe, "No input." )
26  self.fGframe.AddFrame( self.fLabel, TGLayoutHints( kLHintsTop | kLHintsLeft, 5, 5, 5, 5) )
27  self.AddFrame( self.fGframe, TGLayoutHints( kLHintsExpandX, 2, 2, 1, 1 ) )
28 
29  self.SetCleanup( kDeepCleanup )
30  self.SetWindowName( "Number Entry" )
31  self.MapSubwindows()
32  self.Resize( self.GetDefaultSize() )
33  self.MapWindow()
34 
35  def __del__( self ):
36  self.Cleanup()
37 
38  def DoSetlabel( self ):
39  self.fLabel.SetText( Form( "%d" % self.fNumber.GetNumberEntry().GetIntNumber() ) )
40  self.fGframe.Layout()
41 
42 
43 if __name__ == '__main__':
44  window = pMyMainFrame( gClient.GetRoot(), 50, 50 )
45 
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:587
virtual void MapSubwindows()
Definition: TGFrame.h:263
void SetWindowName(const char *name=0)
Set window name. This is typically done via the window manager.
Definition: TGFrame.cxx:1746
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
Definition: TGFrame.cxx:566
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot...
Definition: TQObject.cxx:1135
char * Form(const char *fmt,...)
virtual void SetCleanup(Int_t=kLocalCleanup)
Definition: TGFrame.h:280
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1099
virtual void MapWindow()
Definition: TGFrame.h:267
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
Definition: TGFrame.cxx:949