@@ -656,7 +656,7 @@ class TextBox(AxesWidget):
656
656
"""
657
657
658
658
def __init__ (self , ax , label , initial = '' ,
659
- color = '.95' , hovercolor = '1' ):
659
+ color = '.95' , hovercolor = '1' , label_pad = .01 ):
660
660
"""
661
661
Parameters
662
662
----------
@@ -675,6 +675,9 @@ def __init__(self, ax, label, initial='',
675
675
676
676
hovercolor : color
677
677
The color of the box when the mouse is over it
678
+
679
+ label_pad : float
680
+ the distance between the label and the right side of the textbox
678
681
"""
679
682
AxesWidget .__init__ (self , ax )
680
683
@@ -686,7 +689,7 @@ def __init__(self, ax, label, initial='',
686
689
self .params_to_disable += [key ]
687
690
688
691
self .text = initial
689
- self .label = ax .text (- 0.01 , 0.5 , label ,
692
+ self .label = ax .text (- label_pad , 0.5 , label ,
690
693
verticalalignment = 'center' ,
691
694
horizontalalignment = 'right' ,
692
695
transform = ax .transAxes )
@@ -805,7 +808,7 @@ def _keypress(self, event):
805
808
func (self .text )
806
809
if key == "enter" :
807
810
self ._notify_submit_observers ()
808
-
811
+
809
812
def begin_typing (self , x ):
810
813
self .capturekeystrokes = True
811
814
#disable command keys so that the user can type without
@@ -816,10 +819,9 @@ def begin_typing(self, x):
816
819
rcParams [key ] = []
817
820
#now, we have to figure out where the cursor goes.
818
821
#approximate it based on assuming all characters the same length
819
- print (x )
820
822
self .cursor_index = len (self .text )
821
823
self ._rendercursor ()
822
-
824
+
823
825
def stop_typing (self ):
824
826
notifysubmit = False
825
827
# because _notify_submit_users might throw an error in the
@@ -837,7 +839,7 @@ def stop_typing(self):
837
839
if notifysubmit :
838
840
self ._notify_submit_observers ()
839
841
840
-
842
+
841
843
def _click (self , event ):
842
844
if self .ignore (event ):
843
845
return
@@ -850,10 +852,10 @@ def _click(self, event):
850
852
event .canvas .grab_mouse (self .ax )
851
853
if not (self .capturekeystrokes ):
852
854
self .begin_typing (event .x )
853
-
855
+
854
856
def _resize (self , event ):
855
857
self .stop_typing ()
856
-
858
+
857
859
def _motion (self , event ):
858
860
if self .ignore (event ):
859
861
return
0 commit comments