Dave and Kerrie Giesen | 3 Feb 03:53 2010
Picon

Re: Swapping 2 widgets btween 2 cells in a grid-layout

You should be able to do something like the following:

# initial grid
label1.grid(row=0, column=0)
label2.grid(row=1, column=0)

# remove the labels from the grid so that they forget their original 
location
label1.grid_forget()
label2.grid_forget()

# Put the labels back but switched
label2.grid(row=0, column=0)
label1.grid(row=1, column=0)

Dave

GKalman wrote:
> I would like to swap the (grid cell) positions of 2 label-widgets (in an
> array of widgets) in response to a mouse-event. (I have no trouble swapping
> variables, but can't do it with widgets). Any suggestions or references
> would be appreciated.
>
>  
>   
Nemes Andrei | 9 Feb 02:38 2010
Picon

menu bug

Hi!
I am trying to make a menu that uses small icons as well as text, but when I open the main menu, the icon in the pull down menu is not correctly displayed until I hoover over it. Could someone please be so kind to tell me what's wrong and how can I solve this. Image with error attached (or viewable at http://img11.imageshack.us/img11/9429/bugft.jpg)
Thank you.

menu code:
        #building icon set
        self.info=Pho toImage(file="gui/information.gif")

        #menu init
        self.myMenu=Menu(self)

        #help menu
        self.menu_help=Menu(self.myMenu, tearoff=0)
        self.menu_help.add_command(label="Credits ", command=mda)
        self.menu_help.add_command(label="About "+name, image=self.info, compound="left", command=mda)
        self.myMenu.add_cascade(label="Help", menu=self.menu_help)

        #show menu bar
        self.config(menu=self.myMenu)

Kind regards,
Andrei Nemes

_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss
Lion Kimbro | 9 Feb 21:44 2010
Picon

Re: menu bug


  I have no idea, but would making the image slightly larger, (perhaps workable programmatically,) work as a work-around?


On Mon, Feb 8, 2010 at 5:38 PM, Nemes Andrei <teh_sh_meister <at> yahoo.com> wrote:
Hi!
I am trying to make a menu that uses small icons as well as text, but when I open the main menu, the icon in the pull down menu is not correctly displayed until I hoover over it. Could someone please be so kind to tell me what's wrong and how can I solve this. Image with error attached (or viewable at http://img11.imageshack.us/img11/9429/bugft.jpg)
Thank you.

menu code:
        #building icon set
        self.info=PhotoImage(file="gui/information.gif")

        #menu init
        self.myMenu=Menu(self)

        #help menu
        self.menu_help=Menu(self.myMenu, tearoff=0)
        self.menu_help.add_command(label="Credits ", command=mda)
        self.menu_help.add_command(label="About "+name, image=self.info, compound="left", command=mda)
        self.myMenu.add_cascade(label="Help", menu=self.menu_help)

        #show menu bar
        self.config(menu=self.myMenu)

Kind regards,
Andrei Nemes


_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss


_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss
John McMonagle | 10 Feb 00:16 2010

Re: {Possible_Spam} menu bug

Nemes Andrei wrote:
> Hi!
> I am trying to make a menu that uses small icons as well as text, but
> when I open the main menu, the icon in the pull down menu is not
> correctly displayed until I hoover over it. Could someone please be so
> kind to tell me what's wrong and how can I solve this. Image with error
> attached (or viewable at http://img11.imageshack.us/img11/9429/bugft.jpg)
> Thank you.

It works correctly on my setup.

tcl/tk 8.4.15
python 2.5.1
openSuse 10.3
kde 3.5.7

Regards,

John
Wayne Watson | 11 Feb 00:14 2010
Picon
Picon

Exiting a Tkinter Program-- An Anomaly or two

I'm looking a 1800+ line someone else wrote. It uses one large dialog 
for menus, and has a large area for images. A few menus open small 
dialogs, for example, to enter a file name. The File menu has an exit 
choice. The only other exit is the x in the upper right corner of the 
large dialog. I'm pretty sure that menu is coded to quit via a short def 
in the program.

def Quit(self)
    self.running = False
    self.master.quit()

I see no other code to quit. If I use Exit(menu item), the program does 
not quit. If I then use the x, it quits and the shell script is left 
open for a command. Any ideas why Quit doesn't work in the first case? 
It's accessible  via a
self.mainMenu.add_command(.. command=self.Quit)
I  had not turned the program loose by using a menu or touching any 
controls.

If I cause the program to print to the shell, and then use x to exit 
that it hangs the shell. Why? When I x the shell, it tells me  the prog 
is running." Do I want to kill it?" Yes, kills the shell  window.

The above seems abnormal to me. Comments?
--

-- 
"Crime is way down. War is declining. And that's far from the good 
news." -- Steven Pinker (and other sources) Why is this true, but yet 
the media says otherwise? The media knows very well how to manipulate us 
(see limbic, emotion, $$). -- WTW
Kevin Walzer | 11 Feb 03:07 2010

Re: Exiting a Tkinter Program-- An Anomaly or two

On 2/10/10 6:14 PM, Wayne Watson wrote:
>
> def Quit(self)
> self.running = False
> self.master.quit()
>
>

If you change self.master.quit() to sys.exit(), what happens?

(Also make sure that "import sys" is somewhere in the code.)

--

-- 
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
Wayne Watson | 11 Feb 05:33 2010
Picon
Picon

Re: Exiting a Tkinter Program-- An Anomaly or two

I get the small dialog "Do you want to exit altogether?". I press yes. 
The shell and program windows close. If I say no, then I get error 
messages in the shell followed by a command prompt. The program 
continues to operate.

Well, this isn't bad, but it probably changes how I want to print to the 
shell. If I exit this way, the shell closes and the user can't inspect 
the output any further. Probably, I need to print to a text window 
instead. I have no idea if it will close to with the exit. It seems 
likely. If yes,then I need to write the text fo a file.

On 2/10/2010 6:07 PM, Kevin Walzer wrote:
> On 2/10/10 6:14 PM, Wayne Watson wrote:
>>
>> def Quit(self)
>> self.running = False
>> self.master.quit()
>>
>>
>
> If you change self.master.quit() to sys.exit(), what happens?
>
> (Also make sure that "import sys" is somewhere in the code.)
>

--

-- 
"Crime is way down. War is declining. And that's far from the good 
news." -- Steven Pinker (and other sources) Why is this true, but yet 
the media says otherwise? The media knows very well how to manipulate us 
(see limbic, emotion, $$). -- WTW
Wayne Watson | 11 Feb 22:18 2010
Picon
Picon

Re: Exiting a Tkinter Program-- An Anomaly or two

Just did now and the msg showed up.

On 2/11/2010 10:54 AM, Peter Milliken wrote:
Have you tried putting a print statement in the Quit method to determine if the correct quit is being called?

On Thu, Feb 11, 2010 at 10:14 AM, Wayne Watson <sierra_mtnview <at> sbcglobal.net> wrote:
I'm looking a 1800+ line someone else wrote. It uses one large dialog for menus, and has a large area for images. A few menus open small dialogs, for example, to enter a file name. The File menu has an exit choice. The only other exit is the x in the upper right corner of the large dialog. I'm pretty sure that menu is coded to quit via a short def in the program.

def Quit(self)
  self.running = False
  self.master.quit()

I see no other code to quit. If I use Exit(menu item), the program does not quit. If I then use the x, it quits and the shell script is left open for a command. Any ideas why Quit doesn't work in the first case? It's accessible  via a
self.mainMenu.add_command(.. command=self.Quit)
I  had not turned the program loose by using a menu or touching any controls.

If I cause the program to print to the shell, and then use x to exit that it hangs the shell. Why? When I x the shell, it tells me  the prog is running." Do I want to kill it?" Yes, kills the shell  window.

The above seems abnormal to me. Comments?
--
"Crime is way down. War is declining. And that's far from the good news." -- Steven Pinker (and other sources) Why is this true, but yet the media says otherwise? The media knows very well how to manipulate us (see limbic, emotion, $$). -- WTW
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss


--
"Crime is way down. War is declining. And that's far from the good news." -- Steven Pinker (and other sources) Why is this true, but yet the media says otherwise? The media knows very well how to manipulate us (see limbic, emotion, $$). -- WTW
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss
Wayne Watson | 13 Feb 02:00 2010
Picon
Picon

Re: Exiting a Tkinter Program-- An Anomaly or two

I have no qualms about sending you the code. The code by itself would not be executable though unless I provide several files. The critical ones are a jpg, which is used to fill the initial display area, and two others that have to do with color and making a movie. A minimum of two data files may be needed, but I suspect they could be skipped. If they are necessary, then it's a simple matter of creating an Events folder and putting them there. The py and extra files need to in the same folder. It runs in Py 2.5. I guess the data files would be useful in  the case where one might test the exit when data is viewed. I think I found the same results.

On 2/11/2010 2:27 PM, Peter Milliken wrote:
It does look strange, but with only the code you present we can only make some assumptions i.e. 

self.running = False

implies (to me :-)) that there are likely tasks running and this flag is being used to shut them down?

self.master is presumably the widget derived from the 'standard' line:

root = Tk()

that you normally find in a program? or is self.master some other widget?

Does the class that Quit is a method of inherit from something?

It is pretty hard to work out (on the surface) why this method won't work from the menu.

Peter

On Fri, Feb 12, 2010 at 8:18 AM, Wayne Watson <sierra_mtnview <at> sbcglobal.net> wrote:
Just did now and the msg showed up.


On 2/11/2010 10:54 AM, Peter Milliken wrote:
Have you tried putting a print statement in the Quit method to determine if the correct quit is being called?

On Thu, Feb 11, 2010 at 10:14 AM, Wayne Watson <sierra_mtnview <at> sbcglobal.net> wrote:
I'm looking a 1800+ line someone else wrote. It uses one large dialog for menus, and has a large area for images. A few menus open small dialogs, for example, to enter a file name. The File menu has an exit choice. The only other exit is the x in the upper right corner of the large dialog. I'm pretty sure that menu is coded to quit via a short def in the program.

def Quit(self)
  self.running = False
  self.master.quit()

I see no other code to quit. If I use Exit(menu item), the program does not quit. If I then use the x, it quits and the shell script is left open for a command. Any ideas why Quit doesn't work in the first case? It's accessible  via a
self.mainMenu.add_command(.. command=self.Quit)
I  had not turned the program loose by using a menu or touching any controls.

If I cause the program to print to the shell, and then use x to exit that it hangs the shell. Why? When I x the shell, it tells me  the prog is running." Do I want to kill it?" Yes, kills the shell  window.

The above seems abnormal to me. Comments?
--
"Crime is way down. War is declining. And that's far from the good news." -- Steven Pinker (and other sources) Why is this true, but yet the media says otherwise? The media knows very well how to manipulate us (see limbic, emotion, $$). -- WTW
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss


--
"Crime is way down. War is declining. And that's far from the good news." -- Steven Pinker (and other sources) Why is this true, but yet the media says otherwise? The media knows very well how to manipulate us (see limbic, emotion, $$). -- WTW


--
"Crime is way down. War is declining. And that's far from the good news." -- Steven Pinker (and other sources) Why is this true, but yet the media says otherwise? The media knows very well how to manipulate us (see limbic, emotion, $$). -- WTW
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss
Michael Lange | 13 Feb 12:25 2010
Picon

Re: Exiting a Tkinter Program-- An Anomaly or two

Hi,

On Fri, 12 Feb 2010 17:00:18 -0800
Wayne Watson <sierra_mtnview <at> sbcglobal.net> wrote:

> I have no qualms about sending you the code. The code by itself would
> not be executable though unless I provide several files. The critical
> ones are a jpg, which is used to fill the initial display area, and
> two others that have to do with color and making a movie. A minimum
> of two data files may be needed, but I suspect they could be skipped.
> If they are necessary, then it's a simple matter of creating an
> Events folder and putting them there. The py and extra files need to
> in the same folder. It runs in Py 2.5. I guess the data files would
> be useful in  the case where one might test the exit when data is
> viewed. I think I found the same results.

Just a guess:

you say the program "is making a movie", so maybe the program uses
threads and a child thread is still running when you quit the program ?

Regards

Michael

Gmane