Tkinter - resize tkMessageBox

2007-06-04 Thread rahulnag22
Hi,
Is there a way to resize the width of the "tkMessageBox.askyesno"
dialog box, so that the text does not wrap to the next line.
Thanks
Rahul

-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter - Force toplevel window to stay on top of Tk() window

2007-06-08 Thread rahulnag22
Hi,
I have a Tk() window "base_win = Tk()" with multiple frames on it
having a combination of widgets. If I click on say a button widget
which launches a new top level window "new_win = TopLevel()", I was
looking for a way for this "new_win" to always stay on top of
"base_win" till I close "new_win", as a result also not allowing any
selections to be made in the "base_win" .
Thanks
Rahul

-- 
http://mail.python.org/mailman/listinfo/python-list


tkinter listboxes

2007-05-03 Thread rahulnag22
I will give a simplified example of the problem at hand --

I have a case in which I have two listboxes - listbox1 and listbox2,
if I click on an item in listbox1 the item gets highlighted as
expected. Now if I click on an item in listbox2 the selected item in
listbox1 loses its highlight. My question is how do I keep the
listbox1 item from losing its highlight if I select an item in
listbox2 or to that matter any other widget.

Thanks
Rahul

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: tkinter listboxes

2007-05-04 Thread rahulnag22
On May 4, 1:55 am, "Eric Brunel" <[EMAIL PROTECTED]> wrote:
> On Fri, 04 May 2007 05:26:56 +0200, <[EMAIL PROTECTED]> wrote:
> > I will give a simplified example of the problem at hand --
>
> > I have a case in which I have two listboxes - listbox1 and listbox2,
> > if I click on an item in listbox1 the item gets highlighted as
> > expected. Now if I click on an item in listbox2 the selected item in
> > listbox1 loses its highlight. My question is how do I keep the
> > listbox1 item from losing its highlight if I select an item in
> > listbox2 or to that matter any other widget.
>
> By default, the 'highlighting' is considered as a selection. Since you
> can't have two items selected at the same time, the second cancels the
> first. To avoid this behaviour, make each list keep its selection to
> itself by using the 'exportselection=0' option when you create the Listbox
> instance. This should work as you expect.
>
> HTH
> --
> python -c "print ''.join([chr(154 - ord(c)) for c in
> 'U(17zX(%,5.zmz5(17l8(%,5.Z*(93-965$l7+-'])"


Eric that works. Thank You. James thank you for the detailed
explanation it will be useful for me.
Regards
Rahul

-- 
http://mail.python.org/mailman/listinfo/python-list


tkinter - label widget text selection

2007-05-06 Thread rahulnag22
Hi,
I guess this is a very trivial question --
I am using a label widget to display text (black font in a white
background color). I am trying to use my mouse to scroll over the
displayed text to select it, but tkinter does not allow me to do it.
Is there a method/option to do this.
Thanks
Rahul

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: tkinter - label widget text selection

2007-05-08 Thread rahulnag22
On May 6, 2:24 pm, Rob Wolfe <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] writes:
> > Hi,
> > I guess this is a very trivial question --
> > I am using a label widget to display text (black font in a white
> > background color). I am trying to use my mouse to scroll over the
> > displayed text to select it, buttkinterdoes not allow me to do it.
> > Is there a method/option to do this.
>
> Try to use an entry widget in read-only state:
>
> 
> importTkinteras Tk
> root = Tk.Tk()
>
> ent = Tk.Entry(root, state='readonly', readonlybackground='white', fg='black')
> var = Tk.StringVar()
> var.set('Some text')
> ent.config(textvariable=var, relief='flat')
> ent.pack()
> root.mainloop()
> 
>
> --
> HTH,
> Rob

Thanks Rob I will try it out...Rahul

-- 
http://mail.python.org/mailman/listinfo/python-list


tkinter get widget option value

2007-05-08 Thread rahulnag22
Hi,
If I have a button widget

w = Button(root, text = "Button", state = 'disabled')

How can I get the value of option 'state' from the widget 'w'.
I want something like --

print w.state  >> to print out >> 'disabled'

Thanks
Rahul

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: tkinter get widget option value

2007-05-08 Thread rahulnag22
On May 8, 2:15 pm, Rob Williscroft <[EMAIL PROTECTED]> wrote:
>  wrote innews:[EMAIL PROTECTED]
> comp.lang.python:
>
> > If I have a button widget
>
> > w = Button(root, text = "Button", state = 'disabled')
>
> > How can I get the value of option 'state' from the widget 'w'.
> > I want something like --
>
> > print w.state  >> to print out >> 'disabled'
>
> print w.cget( "state" )
>
> Rob.
> --http://www.victim-prime.dsl.pipex.com/

Thanks Rob, that does it.

-- 
http://mail.python.org/mailman/listinfo/python-list


tkinter - Screen Resolution

2007-05-09 Thread rahulnag22
Hi,
I have developed a GUI using tkinter (grid geometory manager).
The structure is a top frame containing multiple subframes. Each
subframe has a combination of widgets like(Entry, label,
button,listboxes). The subframes are placed with a padx and pady
offset with regards to the other subframes. And the widgets within
these subframes have their own padx and pady offsets. The GUI runs
fine on my linux box, but on a different linux box things get wierd.
I see things like-
1) The frame width increasing
2) The widget padx translating to much bigger offsets with reference
to the subframe edges
3) Widget widths like that for Entry become bigger

I Know its to do with the screen resolution settings and user settings
on different machines. Can anyone point me in the right
direction(before I start looking into it)as how to account for
different screen resolutions so as to have as uniform a GUI look as
possible across different user machines.
A smaller version of my GUI layout looks something like-->

===Top Frame=
=- SubFrame - -SubFrame-
=-- -
'
-
=-- - '   Widget   ' -
=-- -
' -
=-   Widget   - -
=-
-
=-- -SubFrame-
=-- -
-
=-- -
'
-
=-   Widget- -   '   Widget   '  -
=-- -
'   -
=-- -
-
=-- -
'
-
=-- -   '   Widget   '   -
=-  Widget- -   '
-
=--- -
=


Thanks
Rahul

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: tkinter - Screen Resolution

2007-05-09 Thread rahulnag22
On May 9, 10:37 am, [EMAIL PROTECTED] wrote:
> Hi,
> I have developed a GUI using tkinter (grid geometory manager).
> The structure is a top frame containing multiple subframes. Each
> subframe has a combination of widgets like(Entry, label,
> button,listboxes). The subframes are placed with a padx and pady
> offset with regards to the other subframes. And the widgets within
> these subframes have their own padx and pady offsets. The GUI runs
> fine on my linux box, but on a different linux box things get wierd.
> I see things like-
> 1) The frame width increasing
> 2) The widget padx translating to much bigger offsets with reference
> to the subframe edges
> 3) Widget widths like that for Entry become bigger
>
> I Know its to do with the screen resolution settings and user settings
> on different machines. Can anyone point me in the right
> direction(before I start looking into it)as how to account for
> different screen resolutions so as to have as uniform a GUI look as
> possible across different user machines.
> A smaller version of my GUI layout looks something like-->
>
> ===Top Frame=
> =- SubFrame - -SubFrame-
> =-- - ' -
> =-- - '   Widget   ' -
> =-- - ' -
> =-   Widget   - -
> =-  -
> =-- -SubFrame-
> =-- -   -
> =-- - ' -
> =-   Widget- -'   Widget   ' -
> =-- - ' -
> =-- -   -
> =-- - ' -
> =-- - '   Widget   ' -
> =-  Widget- - '  -
> =--- -
> =
>
> Thanks
> Rahul


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: tkinter get widget option value

2007-05-09 Thread rahulnag22
On May 8, 6:51 pm, James Stroud <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > Hi,
> > If I have abuttonwidget
>
> > w =Button(root, text = "Button", state = 'disabled')
>
> > How can I get the value of option 'state' from the widget 'w'.
> > I want something like --
>
> > print w.state  >> to print out >> 'disabled'
>
> > Thanks
> > Rahul
>
> print w["state"]
>
> James


Thanks! James

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: tkinter - Screen Resolution

2007-05-10 Thread rahulnag22
On May 10, 1:29 am, "Eric Brunel" <[EMAIL PROTECTED]> wrote:
> On Wed, 09 May 2007 18:37:32 +0200, <[EMAIL PROTECTED]> wrote:
> > Hi,
> > I have developed a GUI usingtkinter(grid geometory manager).
> > The structure is a top frame containing multiple subframes. Each
> > subframe has a combination of widgets like(Entry, label,
> > button,listboxes). The subframes are placed with a padx and pady
> > offset with regards to the other subframes. And the widgets within
> > these subframes have their own padx and pady offsets. The GUI runs
> > fine on my linux box, but on a different linux box things get wierd.
> > I see things like-
> > 1) The frame width increasing
> > 2) The widget padx translating to much bigger offsets with reference
> > to the subframe edges
> > 3) Widget widths like that for Entry become bigger
>
> > I Know its to do with the screen resolution settings and user settings
> > on different machines. Can anyone point me in the right
> > direction(before I start looking into it)as how to account for
> > different screen resolutions so as to have as uniform a GUI look as
> > possible across different user machines.
>
> [snip]
>
> For some reason, tk uses different default units for coordinates and font
> sizes: a coordinate specified as just a number is considered to be in
> pixels (a.k.a screen points); a font size specified as just a number is
> considered to be in points, i.e 1/72 inch. So these units are the same
> only if your screen resolution is exactly 72 dpi, which is usually not the
> case.
>
> If this is actually your problem, the way to correct it is quite simple:
> the tk command "tk scaling 1" tells tk that a point and a pixel are the
> same thing. To issue it, you may have to use explicitely the tcl
> interpreter used byTkinterby doing:
> aWidget.tk.call('tk', 'scaling', 1)
> where aWidget is anyTkinterwidget. This is what I had to do with Python
> 2.1; it may be easier with later Python/Tkinterversions.
>
> HTH
> --
> python -c "print ''.join([chr(154 - ord(c)) for c in
> 'U(17zX(%,5.zmz5(17l8(%,5.Z*(93-965$l7+-'])"


This is just what I watned...Thanks that works great -Rahul

-- 
http://mail.python.org/mailman/listinfo/python-list


tkinter button state = DISABLED

2007-05-14 Thread rahulnag22
I have created a button widget with a button click binding. The button
initially has a state=disabled. I can see the greyed out version of
the button in the GUI. But If I click on the button it still invokes
the callback/binding function.

Any suggestions as to why the callback is being invoked even though
the button has a disabled state. It looks like-

b=Button(frame,  text = "Button", state = 'disabled')

b.bind("",
lambda
event :
function()
)

Thanks
Rahul

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: tkinter button state = DISABLED

2007-05-14 Thread rahulnag22
On May 14, 12:01 pm, Peter Otten <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > I have created a button widget with a button click binding. The button
> > initially has a state=disabled. I can see the greyed out version of
> > the button in the GUI. But If I click on the button it still invokes
> > the callback/binding function.
>
> > Any suggestions as to why the callback is being invoked even though
> > the button has a disabled state. It looks like-
>
> > b=Button(frame,  text = "Button", state = 'disabled')
>
> > b.bind("",
> > lambda
> > event :
> > function()
> > )
>
> Well, the /mouse/ button /was/ released. Do you know about the alternative?
>
> b = Button(..., command=function) # no bind(), no lambda
>
> It behaves like you expect.
>
> Peter


So, then is it right to say that for a widget like button widget on
occurance of a 'event' the function which is bound to this event is
invoked, even if the button widget has its 'state' option set to
'disabled'. I was assuming that if the button widget has state =
'disabled' then even on a button event the binding function wont be
invoked.
I will take a look at the alternative code you suggested above too.

Thanks
Rahul

-- 
http://mail.python.org/mailman/listinfo/python-list


tkFileDialog.askopenfilename()

2007-05-15 Thread rahulnag22
Hi,
When I call tkFileDialog.askopenfilename() , the dialog box opens with
the current directory as the default directory. Is it possible to open
the dialog box with a directory other than the current directory. Can
we pass in  a user defined starting directory.
Thanks
Rahul

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: tkFileDialog.askopenfilename()

2007-05-17 Thread rahulnag22
On May 16, 6:21 am, "Hamilton, William " <[EMAIL PROTECTED]> wrote:
> > From: [EMAIL PROTECTED]
>
> > Hi,
> > When I call tkFileDialog.askopenfilename() , the dialog box opens with
> > the current directory as the default directory. Is it possible to open
> > the dialog box with a directory other than the current directory. Can
> > we pass in  a user defined starting directory.
> > Thanks
> > Rahul
>
> This link has a decent amount of info about the various dialog 
> modules.http://www.pythonware.com/library/tkinter/introduction/x1164-data-ent...
>
> ---
> -Bill Hamilton

Thanks for the links ppl. That helped

-- 
http://mail.python.org/mailman/listinfo/python-list


Listbox - Active index

2007-05-25 Thread rahulnag22
Hi,
I am using a listbox in selectmode = MULTIPLE, I can get the current
selected item in the listbox from index = "ACTIVE" , but is there a
way to convert this "ACTIVE" to get the current selection index as a
number.

For multiple selectmode listboxes it returns a tuple of selected
indexes, so I would have to write some extra code to get the current
active selection index from the tuple, instead I was hoping there
would be a way to get the current selection index number from the
"ACTIVE" index.

Thanks
Rahul

-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter Listbox - Different Text colors in one listbox

2007-05-29 Thread rahulnag22
Hi,
Is it possible to have different items in a listbox in different
colors? Or is it just one color for all items in a listbox?
Thanks
Rahul

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter Listbox - Different Text colors in one listbox

2007-05-30 Thread rahulnag22
On May 30, 6:04 am, [EMAIL PROTECTED] wrote:
> On May 29, 2:02 pm, [EMAIL PROTECTED] wrote:
>
> > Hi,
> > Is it possible to havedifferentitems in alistboxindifferentcolors? Or is it 
> > justonecolor for all items in alistbox?
> > Thanks
> > Rahul
>
> from Tkinter import *
>
> root = Tk()
> l = Listbox(root)
> l.pack()
> for x in range(10):
> l.insert(END, x)
> l.itemconfig(2, bg='red', fg='white')
> l.itemconfig(4, bg='green', fg='white')
> l.itemconfig(5, bg='cyan', fg='white')
> root.mainloop()
>
> You can _only_ configurate 'background', 'foreground',
> 'selectbackground', 'selectforegroud', not font :(
>
> HTH

Thanks for the feedback all. I tried the itemconfig method and it
works great.
Thanks

-- 
http://mail.python.org/mailman/listinfo/python-list