Amit Finkler | 1 Jan 2008 11:04
Picon

Entry Widget - Setting a Default Text - continuted

Hi,


I tried setting up the following GUI:


import Numeric, time
from Tkinter import *
import tkFileDialog

def exec_2D():
        """Main execution function. Takes input values from user, i.e. magnetic field and current values, filename, series resistance and runs a two-dimensional scan, line scans over the current for each magnetic field value."""
    yoko_gpib = int(YokoAdr.get())
    mag_gpib = int(MagAdr.get())
    dmm_gpib = int(DMMAdr.get())
    Rs       = float(Rs_entr.get())
    mag_coef = float(Mg_entr.get())
    StartI   = float(Ie_init.get())*Rs
    EndI     = float(Ie_finl.get())*Rs
    StepI    = float(Ie_step.get())*Rs
    StartH   = float(He_init.get())/mag_coef
    EndH     = float(He_finl.get())/mag_coef
    StepH    = float(He_step.get())/mag_coef
       
def RampYoko():

    yoko_gpib = int(YokoAdr.get())
    Rs        = float(Rs_entr.get())
    StartI    = float(Ie_init.get())*Rs
    StepI     = float(Ie_step.get())*Rs

def RampMag():

    mag_gpib  = int(MagAdr.get())
    mag_coef = float(Mg_entr.get())
    StartH    = float(He_init.get())/mag_coef
    StepH     = float(He_step.get())/mag_coef

def cooldown():           
    """Cooldown procedure. Call subprocedure of miniprograms to run a cooldown measurement"""

    lake_gpib = int(LakeAdr.get())
    dmm_gpib       = int(DMMAdr.get())
    yoko_gpib      = int(YokoAdr.get())
    Rs             = float(Rs_entr.get())
    StartI         = float(Ie_init.get())*Rs

def IV_DC():
    """DC IV procedure. Call subprocedure dc_scan of miniprograms module to run an IV measurement"""   
    yoko_gpib = int(YokoAdr.get())
    dmm_gpib = int(DMMAdr.get())
    Rs       = float(Rs_entr.get())
    StartI   = float(Ie_init.get())*Rs
    EndI     = float(Ie_finl.get())*Rs
    StepI    = float(Ie_step.get())*Rs
           
def Mag_DC():
    """DC Magnetic field dependence procedure. CAll subprocedure mag_field_dc_scan of miniprograms module to run a mag measurement"""   

    mag_gpib = int(MagAdr.get())
    dmm_gpib = int(DMMAdr.get())
    mag_coef = float(Mg_entr.get())
    StartH   = float(He_init.get())/mag_coef
    EndH     = float(He_finl.get())/mag_coef
    StepH    = float(He_step.get())/mag_coef       
                   
def file_save_as(event):
    """ Simple function, whose input is a mouse button click and its, opening a dialog box asking the user for a filename to save the data in and in return prints out a label to the right of the button which states the path of this file. Mostly serves as an indicator to the user where he/she saves his/her file."""
    global fn
    fn  = tkFileDialog.asksaveasfilename()
    FilenameDisplay.configure(text = fn,fg = 'white', bg = 'black')
   
def query_Yokogawa(event):
    """ Real-time query of the current output of the Yokogawa power supply. Input is a mouse button click. Output is the current output displayed to the right of that button. Standard procedure really. """   

    yokogawa_gpib = int(YokoAdr.get())

def query_temperature(event):
    """ Real-time query of the current temperature in the bottom of the rod as measured by the Lakeshore 330 temperature controller. Input is a mouse button click. Output is the current temperature displayed to the right of that button. Standard procedure really. """   
   


def query_temperature2(event):
    """ Real-time query of the current temperature in the bottom of the rod as measured by the Lakeshore 330 temperature controller. Input is a mouse button click. Output is the current temperature displayed to the right of that button. Standard procedure really. """   
   

       
def query_field(event):
    """ Real-time query of the current external magnetic field in play. Input is a mouse button click. Output is the current magnetic field displayed to the right of that button. Standard procedure really. """   


##########################################################
#                                                        #    
#                     END OF FUNCTIONS                   #
#                                                        #
##########################################################
   
# Define main windows and their subframes
win              = Tk()
win.title('Control Panel')

win2             = Tk()
win2.title('Configuration and Monitoring')

f                = Frame(win, bd = 2, relief = 'groove')
f2               = Frame(win2, bd = 2, relief = 'groove')

# Define variables and their default values

I_init       = StringVar()
H_init       = StringVar()
I_finl       = StringVar()
H_finl       = StringVar()
I_step       = StringVar()
H_step       = StringVar()
R_ser        = IntVar()
M_coef       = IntVar()
R_ser.set('10000')
M_coef.set('1119')

Yoko_adr     = IntVar()
Mag_adr      = IntVar()
DMM_adr      = IntVar()
Lake_adr     = IntVar()
Lake2_adr    = IntVar()
Yoko_adr.set('2')
Mag_adr.set('10')
DMM_adr.set('22')
Lake_adr.set('12')
Lake2_adr.set('1')



# Variable input boxes from user

Ie_init       = Entry(f, textvariable = I_init)
He_init       = Entry(f, textvariable = H_init)
Ie_finl       = Entry(f, textvariable = I_finl)
He_finl       = Entry(f, textvariable = H_finl)
Ie_step       = Entry(f, textvariable = I_step)
He_step       = Entry(f, textvariable = H_step)
Rs_entr       = Entry(f, textvariable = R_ser)
Mg_entr       = Entry(f, textvariable = M_coef)
Il_init       = Label(f, text         = 'Initial/set current [A]')
Hl_init       = Label(f, text         = 'Initial field [Gauss]')
Il_finl       = Label(f, text         = 'Final current [A]')
Hl_finl       = Label(f, text         = 'Final field [Gauss]')
Il_step       = Label(f, text         = 'Current step[A]')
Hl_step       = Label(f, text         = 'Field step[Gauss]')
Rs_labl       = Label(f, text         = 'Series Resistance [Ohm]', fg = 'magenta')
Mg_labl       = Label(f, text         = 'Magnet Coef. [Gauss/A]', fg = 'magenta')

YokoAdr       = Entry(f2, textvariable = Yoko_adr)
MagAdr        = Entry(f2, textvariable = Mag_adr)
DMMAdr        = Entry(f2, textvariable = DMM_adr)
LakeAdr       = Entry(f2, textvariable = Lake_adr)
Lake2Adr      = Entry(f2, textvariable = Lake2_adr)
YokoAdrLabel  = Label(f2, text = 'Yoko address')
MagAdrLabel   = Label(f2, text = 'Magnet address')
DMMAdrLabel   = Label(f2, text = 'DMM address')
LakeAdrLabel  = Label(f2, text = 'Lakeshore (Rod) address')
Lake2AdrLabel = Label(f2, text = 'Lakeshore (Cryostat) address')



# Place input boxes and labels on a grid

YokoAdrLabel.grid(row  = 0, column = 0)
YokoAdr.grid(row       = 1, column = 0)
MagAdrLabel.grid(row   = 2, column = 0)
MagAdr.grid(row        = 3, column = 0)
DMMAdrLabel.grid(row   = 4, column = 0)
DMMAdr.grid(row        = 5, column = 0)
LakeAdrLabel.grid(row  = 6, column = 0)
LakeAdr.grid(row       = 7, column = 0)
Lake2AdrLabel.grid(row = 8, column = 0)
Lake2Adr.grid(row      = 9, column = 0)

Il_init.grid(row = 0, column = 0)
Hl_init.grid(row = 0, column = 2)
Ie_init.grid(row = 1, column = 0)
He_init.grid(row = 1, column = 2)
Il_finl.grid(row = 2, column = 0)
Hl_finl.grid(row = 2, column = 2)
Ie_finl.grid(row = 3, column = 0)
He_finl.grid(row = 3, column = 2)
Il_step.grid(row = 4, column = 0)
Hl_step.grid(row = 4, column = 2)
Ie_step.grid(row = 5, column = 0)
He_step.grid(row = 5, column = 2)
Rs_labl.grid(row = 6, column = 0)
Rs_entr.grid(row = 7, column = 0)
Mg_labl.grid(row = 6, column = 2)
Mg_entr.grid(row = 7, column = 2)

# Define execute 2D scan button
RunFrame             = Frame(win, bd = 2, relief = 'groove')
Run2D                = Button(RunFrame)
Run2D.configure(text = 'Run 2D', fg = 'blue', command = exec_2D)
Run2D.pack(side = LEFT)
RunCooldown          = Button(RunFrame)
RunCooldown.configure(text = 'Cooldown', fg = 'blue', command = cooldown)
RunCooldown.pack(side = LEFT)
RunIVDC              = Button(RunFrame)
RunIVDC.configure(text = 'IV-DC', fg = 'blue', command = IV_DC)
RunIVDC.pack(side = LEFT)
RunRampYoko          = Button(RunFrame)
RunRampYoko.configure(text = 'Ramp Yoko', fg = 'blue', command = RampYoko)
RunRampYoko.pack(side = LEFT)
RunRampMag           = Button(RunFrame)
RunRampMag.configure(text = 'Ramp Field', fg = 'blue', command = RampMag)
RunRampMag.pack(side = LEFT)
RunMagDC              = Button(RunFrame)
RunMagDC.configure(text = 'Mag-DC', fg = 'blue', command = Mag_DC)
RunMagDC.pack(side = LEFT)

# Define Filename Frame

FilenameFrame = Frame(win, bd = 2, relief = 'groove')
Filename      = Button(FilenameFrame)
Filename.configure(text = 'Save in file...')
Filename.bind("<Button-1>",file_save_as)
Filename.pack(side=LEFT)
FilenameDisplay = Label(FilenameFrame)
FilenameDisplay.pack(side = LEFT)

# Monitor Frame

MonitorFrame  = Frame(win2, bd = 2, relief = 'groove')

QueryField    = Button(MonitorFrame)
QueryField.configure(text = 'Query Field', fg = 'DarkViolet')
QueryField.bind("<Button-1>", query_field)
PrintField    = Label(MonitorFrame)
QueryField.grid(row = 0, column = 0)
PrintField.grid(row = 0, column = 1)

QueryLake     = Button(MonitorFrame)
QueryLake.configure(text = 'Query Rod Temperature', fg = 'DarkViolet')
QueryLake.bind("<Button-1>", query_temperature)
PrintLake     = Label(MonitorFrame)
QueryLake.grid(row = 1, column = 0)
PrintLake.grid(row = 1, column = 1)

QueryLake2    = Button(MonitorFrame)
QueryLake2.configure(text = 'Query Cryostat Temperature', fg = 'DarkViolet')
QueryLake2.bind("<Button-1>", query_temperature2)
PrintLake2    = Label(MonitorFrame)
QueryLake2.grid(row = 2, column = 0)
PrintLake2.grid(row = 2, column = 1)

QueryYoko     = Button(MonitorFrame)
QueryYoko.configure(text = 'Query Yokogawa', fg = 'DarkViolet')
QueryYoko.bind("<Button-1>", query_Yokogawa)
PrintYoko     = Label(MonitorFrame)
QueryYoko.grid(row = 3, column = 0)
PrintYoko.grid(row = 3, column = 1)

# Pack everything together
# Window 1 packing
f.pack()
FilenameFrame.pack()
RunFrame.pack()

# Window 2 packing
f2.pack()
MonitorFrame.pack()

Two windows open, but in window number 2 I set some default text into 5 fields and they don't appear. If, however, I change "win2" to "win" in line 100 (the definition of "f2" frame), all the 5 default numbers appear in their respective widgets.


Any idea why this happens?


Thanks,


Amit.




_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss
Godson Gera | 1 Jan 2008 13:28
Picon

Re: Entry Widget - Setting a Default Text - continuted




On Jan 1, 2008 3:34 PM, Amit Finkler <amit.finkler <at> gmail.com> wrote:

Hi,


I tried setting up the following GUI:


import Numeric, time
from Tkinter import *
import tkFileDialog

def exec_2D():
        """Main execution function. Takes input values from user, i.e. magnetic field and current values, filename, series resistance and runs a two-dimensional scan, line scans over the current for each magnetic field value."""
    yoko_gpib = int(YokoAdr.get())
    mag_gpib = int(MagAdr.get())
    dmm_gpib = int(DMMAdr.get())
    Rs       = float(Rs_entr.get())
    mag_coef = float(Mg_entr.get())
    StartI   = float(Ie_init.get())*Rs
    EndI     = float(Ie_finl.get())*Rs
    StepI    = float(Ie_step.get())*Rs
    StartH   = float(He_init.get())/mag_coef
    EndH     = float(He_finl.get())/mag_coef
    StepH    = float(He_step.get())/mag_coef
       
def RampYoko():

    yoko_gpib = int(YokoAdr.get())
    Rs        = float(Rs_entr.get())
    StartI    = float(Ie_init.get())*Rs
    StepI     = float(Ie_step.get())*Rs

def RampMag():

    mag_gpib  = int(MagAdr.get())
    mag_coef = float(Mg_entr.get())
    StartH    = float(He_init.get())/mag_coef
    StepH     = float(He_step.get())/mag_coef

def cooldown():           
    """Cooldown procedure. Call subprocedure of miniprograms to run a cooldown measurement"""

    lake_gpib = int(LakeAdr.get())
    dmm_gpib       = int(DMMAdr.get())
    yoko_gpib      = int(YokoAdr.get())
    Rs             = float(Rs_entr.get())
    StartI         = float(Ie_init.get())*Rs

def IV_DC():
    """DC IV procedure. Call subprocedure dc_scan of miniprograms module to run an IV measurement"""   
    yoko_gpib = int(YokoAdr.get())
    dmm_gpib = int(DMMAdr.get())
    Rs       = float(Rs_entr.get())
    StartI   = float(Ie_init.get())*Rs
    EndI     = float(Ie_finl.get())*Rs
    StepI    = float(Ie_step.get())*Rs
           
def Mag_DC():
    """DC Magnetic field dependence procedure. CAll subprocedure mag_field_dc_scan of miniprograms module to run a mag measurement"""   

    mag_gpib = int(MagAdr.get())
    dmm_gpib = int(DMMAdr.get())
    mag_coef = float(Mg_entr.get())
    StartH   = float(He_init.get())/mag_coef
    EndH     = float(He_finl.get())/mag_coef
    StepH    = float(He_step.get())/mag_coef       
                   
def file_save_as(event):
    """ Simple function, whose input is a mouse button click and its, opening a dialog box asking the user for a filename to save the data in and in return prints out a label to the right of the button which states the path of this file. Mostly serves as an indicator to the user where he/she saves his/her file."""
    global fn
    fn  = tkFileDialog.asksaveasfilename()
    FilenameDisplay.configure(text = fn,fg = 'white', bg = 'black')
   
def query_Yokogawa(event):
    """ Real-time query of the current output of the Yokogawa power supply. Input is a mouse button click. Output is the current output displayed to the right of that button. Standard procedure really. """   

    yokogawa_gpib = int(YokoAdr.get())

def query_temperature(event):
    """ Real-time query of the current temperature in the bottom of the rod as measured by the Lakeshore 330 temperature controller. Input is a mouse button click. Output is the current temperature displayed to the right of that button. Standard procedure really. """   
   


def query_temperature2(event):
    """ Real-time query of the current temperature in the bottom of the rod as measured by the Lakeshore 330 temperature controller. Input is a mouse button click. Output is the current temperature displayed to the right of that button. Standard procedure really. """   
   

       
def query_field(event):
    """ Real-time query of the current external magnetic field in play. Input is a mouse button click. Output is the current magnetic field displayed to the right of that button. Standard procedure really. """   


##########################################################
#                                                        #    
#                     END OF FUNCTIONS                   #
#                                                        #
##########################################################
   
# Define main windows and their subframes
win              = Tk()
win.title('Control Panel')

win2             = Tk()
win2.title('Configuration and Monitoring')

f                = Frame(win, bd = 2, relief = 'groove')
f2               = Frame(win2, bd = 2, relief = 'groove')

# Define variables and their default values

I_init       = StringVar()
H_init       = StringVar()
I_finl       = StringVar()
H_finl       = StringVar()
I_step       = StringVar()
H_step       = StringVar()
R_ser        = IntVar()
M_coef       = IntVar()
R_ser.set('10000')
M_coef.set('1119')

Yoko_adr     = IntVar()
Mag_adr      = IntVar()
DMM_adr      = IntVar()
Lake_adr     = IntVar()
Lake2_adr    = IntVar()
Yoko_adr.set('2')
Mag_adr.set('10')
DMM_adr.set('22')
Lake_adr.set('12')
Lake2_adr.set('1')



# Variable input boxes from user

Ie_init       = Entry(f, textvariable = I_init)
He_init       = Entry(f, textvariable = H_init)
Ie_finl       = Entry(f, textvariable = I_finl)
He_finl       = Entry(f, textvariable = H_finl)
Ie_step       = Entry(f, textvariable = I_step)
He_step       = Entry(f, textvariable = H_step)
Rs_entr       = Entry(f, textvariable = R_ser)
Mg_entr       = Entry(f, textvariable = M_coef)
Il_init       = Label(f, text         = 'Initial/set current [A]')
Hl_init       = Label(f, text         = 'Initial field [Gauss]')
Il_finl       = Label(f, text         = 'Final current [A]')
Hl_finl       = Label(f, text         = 'Final field [Gauss]')
Il_step       = Label(f, text         = 'Current step[A]')
Hl_step       = Label(f, text         = 'Field step[Gauss]')
Rs_labl       = Label(f, text         = 'Series Resistance [Ohm]', fg = 'magenta')
Mg_labl       = Label(f, text         = 'Magnet Coef. [Gauss/A]', fg = 'magenta')

YokoAdr       = Entry(f2, textvariable = Yoko_adr)
MagAdr        = Entry(f2, textvariable = Mag_adr)
DMMAdr        = Entry(f2, textvariable = DMM_adr)
LakeAdr       = Entry(f2, textvariable = Lake_adr)
Lake2Adr      = Entry(f2, textvariable = Lake2_adr)
YokoAdrLabel  = Label(f2, text = 'Yoko address')
MagAdrLabel   = Label(f2, text = 'Magnet address')
DMMAdrLabel   = Label(f2, text = 'DMM address')
LakeAdrLabel  = Label(f2, text = 'Lakeshore (Rod) address')
Lake2AdrLabel = Label(f2, text = 'Lakeshore (Cryostat) address')



# Place input boxes and labels on a grid

YokoAdrLabel.grid(row  = 0, column = 0)
YokoAdr.grid(row       = 1, column = 0)
MagAdrLabel.grid(row   = 2, column = 0)
MagAdr.grid(row        = 3, column = 0)
DMMAdrLabel.grid(row   = 4, column = 0)
DMMAdr.grid(row        = 5, column = 0)
LakeAdrLabel.grid(row  = 6, column = 0)
LakeAdr.grid(row       = 7, column = 0)
Lake2AdrLabel.grid(row = 8, column = 0)
Lake2Adr.grid(row      = 9, column = 0)

Il_init.grid(row = 0, column = 0)
Hl_init.grid(row = 0, column = 2)
Ie_init.grid(row = 1, column = 0)
He_init.grid(row = 1, column = 2)
Il_finl.grid(row = 2, column = 0)
Hl_finl.grid(row = 2, column = 2)
Ie_finl.grid(row = 3, column = 0)
He_finl.grid(row = 3, column = 2)
Il_step.grid(row = 4, column = 0)
Hl_step.grid(row = 4, column = 2)
Ie_step.grid(row = 5, column = 0)
He_step.grid(row = 5, column = 2)
Rs_labl.grid(row = 6, column = 0)
Rs_entr.grid(row = 7, column = 0)
Mg_labl.grid(row = 6, column = 2)
Mg_entr.grid(row = 7, column = 2)

# Define execute 2D scan button
RunFrame             = Frame(win, bd = 2, relief = 'groove')
Run2D                = Button(RunFrame)
Run2D.configure(text = 'Run 2D', fg = 'blue', command = exec_2D)
Run2D.pack(side = LEFT)
RunCooldown          = Button(RunFrame)
RunCooldown.configure(text = 'Cooldown', fg = 'blue', command = cooldown)
RunCooldown.pack(side = LEFT)
RunIVDC              = Button(RunFrame)
RunIVDC.configure(text = 'IV-DC', fg = 'blue', command = IV_DC)
RunIVDC.pack(side = LEFT)
RunRampYoko          = Button(RunFrame)
RunRampYoko.configure(text = 'Ramp Yoko', fg = 'blue', command = RampYoko)
RunRampYoko.pack(side = LEFT)
RunRampMag           = Button(RunFrame)
RunRampMag.configure(text = 'Ramp Field', fg = 'blue', command = RampMag)
RunRampMag.pack(side = LEFT)
RunMagDC              = Button(RunFrame)
RunMagDC.configure(text = 'Mag-DC', fg = 'blue', command = Mag_DC)
RunMagDC.pack(side = LEFT)

# Define Filename Frame

FilenameFrame = Frame(win, bd = 2, relief = 'groove')
Filename      = Button(FilenameFrame)
Filename.configure(text = 'Save in file...')
Filename.bind("<Button-1>",file_save_as)
Filename.pack(side=LEFT)
FilenameDisplay = Label(FilenameFrame)
FilenameDisplay.pack(side = LEFT)

# Monitor Frame

MonitorFrame  = Frame(win2, bd = 2, relief = 'groove')

QueryField    = Button(MonitorFrame)
QueryField.configure(text = 'Query Field', fg = 'DarkViolet')
QueryField.bind("<Button-1>", query_field)
PrintField    = Label(MonitorFrame)
QueryField.grid(row = 0, column = 0)
PrintField.grid(row = 0, column = 1)

QueryLake     = Button(MonitorFrame)
QueryLake.configure(text = 'Query Rod Temperature', fg = 'DarkViolet')
QueryLake.bind("<Button-1>", query_temperature)
PrintLake     = Label(MonitorFrame)
QueryLake.grid(row = 1, column = 0)
PrintLake.grid(row = 1, column = 1)

QueryLake2    = Button(MonitorFrame)
QueryLake2.configure(text = 'Query Cryostat Temperature', fg = 'DarkViolet')
QueryLake2.bind("<Button-1>", query_temperature2)
PrintLake2    = Label(MonitorFrame)
QueryLake2.grid(row = 2, column = 0)
PrintLake2.grid(row = 2, column = 1)

QueryYoko     = Button(MonitorFrame)
QueryYoko.configure(text = 'Query Yokogawa', fg = 'DarkViolet')
QueryYoko.bind("<Button-1>", query_Yokogawa)
PrintYoko     = Label(MonitorFrame)
QueryYoko.grid(row = 3, column = 0)
PrintYoko.grid(row = 3, column = 1)

# Pack everything together
# Window 1 packing
f.pack()
FilenameFrame.pack()
RunFrame.pack()

# Window 2 packing
f2.pack()
MonitorFrame.pack()

Two windows open, but in window number 2 I set some default text into 5 fields and they don't appear. If, however, I change "win2" to "win" in line 100 (the definition of "f2" frame), all the 5 default numbers appear in their respective widgets.


Any idea why this happens?


Thanks,


Amit.


Hi Amit,

There should be only one instance of Tk() in your Tkinter Application (if I remember correctly).

So if you want to create additional windows use Toplevel() instead of Tk(). Toplevel takes optional parent window argument like Toplevel(win)

so line 96 should look like

win2=Toplevel()

HTH

--
Godson Gera,
http://godson.in
Python Tkinter India.
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss
Amit Finkler | 1 Jan 2008 13:39
Picon

Re: Entry Widget - Setting a Default Text - continuted

Hi Amit,

There should be only one instance of Tk() in your Tkinter Application (if I remember correctly).

So if you want to create additional windows use Toplevel() instead of Tk(). Toplevel takes optional parent window argument like Toplevel(win)

so line 96 should look like

win2=Toplevel()

HTH

--
Godson Gera,
http://godson.in
Python Tkinter India.

You remember correctly. This is indeed the solution.


Thanks!


Amit.

_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss
Fredrik Lundh | 2 Jan 2008 18:56
Gravatar

Re: redirecting Python stdout/stderr to a Tkinter text widget from an embedded Python application

Bernard B Yoo wrote:

> I have a Python module that redirects stdout/stderr to a Tkinter text 
> widget.  When I run this from the Python interpreter, it behaves as I 
> expect.  When I run it from a Python batch file, it also behaves as 
> expected.
> 
> When I embed the module in a C program, the Tkinter text widget does not 
> appear.
> 
> Is there something special I must do in embedded Python programs to make 
> Tkinter widgets appear?

you must keep the mainloop running, so that Tk(inter) gets around to 
process the events.

can you perhaps provide some more details on how you're doing the 
redirecting and the embedding?

</F>
Bob Greschke | 6 Jan 2008 00:08
Favicon

DISABLE'ed Entry fields

If you create an Entry field with bg="white and fg="black" and then  
disable it the fg color goes to lightgrey and the fg to grey (with my  
specific color setup on a Solaris box).  Is there a way to stop that  
and keep either the background white or the foreground black?  Either  
one would be fine, but as it is it's kind of hard to read.

Thanks!

Bob
Bob Greschke | 6 Jan 2008 00:12
Favicon

Re: DISABLE'ed Entry fields

Doh.  Grayson didn't list disabled- background and foreground where I  
was looking (under Entry()).

On Jan 5, 2008, at 16:08, Bob Greschke wrote:

> If you create an Entry field with bg="white and fg="black" and then  
> disable it the fg color goes to lightgrey and the fg to grey (with  
> my specific color setup on a Solaris box).  Is there a way to stop  
> that and keep either the background white or the foreground black?   
> Either one would be fine, but as it is it's kind of hard to read.
>
> Thanks!
>
> Bob
>
Fredrik Lundh | 6 Jan 2008 11:02
Gravatar

Re: DISABLE'ed Entry fields

Bob Greschke wrote:

> Doh.  Grayson didn't list disabled- background and foreground where I  
> was looking (under Entry()).

iirc, the disabled* options are relatively recent additions to Tk (for a 
suitable definition of recent, of course).

</F>
Rajeev Nair | 6 Jan 2008 12:09
Picon

Re: Tkinter-discuss Digest, Vol 47, Issue 5

hi

can anyone tell me how to use the entry field to enter system password?
So instead of system asking me in terminal i want to enter the
password through the entry field.

thanks

rajeev
Fredrik Lundh | 6 Jan 2008 14:54
Gravatar

Re: use entry field to enter password (Re: Tkinter-discuss Digest, Vol 47, Issue 5)

(please don't open new threads by replying to some random unrelated 
message.  also, please use a proper subject.  thanks!)

Rajeev Nair wrote:

> can anyone tell me how to use the entry field to enter system password?
> So instead of system asking me in terminal i want to enter the
> password through the entry field.

not sure what you mean by "system" here, but to use the Entry widget to 
enter a password, you can set the "show" option:

     widget = Entry(parent, show="*", width=15)

</F>
Tim Jones | 6 Jan 2008 16:30

Re: use entry field to enter password (Re: Tkinter-discuss Digest, Vol 47, Issue 5)

On Jan 6, 2008, at 6:54 AM, Fredrik Lundh wrote:

> Rajeev Nair wrote:
>
>> can anyone tell me how to use the entry field to enter system  
>> password?
>> So instead of system asking me in terminal i want to enter the
>> password through the entry field.
>
> not sure what you mean by "system" here,

This sounds as if Rajeev is trying to place a wrapper around 'sudo'.   
If so, you'll need to get the username and password and the pass them  
through to the sudo'd command like this (assumes the user is in the / 
etc/sudoers file and that thePassword contains their password):

echo thePassword | sudo -S theCommand

If I've mis-guessed here, please explain what you're trying to  
achieve further.

Tim

Gmane