Using Pmw with Python1.4/Tkinter 
Author Message
 Using Pmw with Python1.4/Tkinter

FOlks,

Me again...
I'm running Python1.4 with tkinter on Win95, and I just installed Pmw0.4.
The demos ran fine, but I've noticed the following quirks :
- Balloon help text appearing at the top left corner of my screen !
- when clicking the down-arrow on a drop-down listbox, the listbox appears
also at the top-left corner of the screen (yes the screen) !

Any advice, idea ?
Thanks.

Jerome



Sat, 01 Apr 2000 03:00:00 GMT  
 Using Pmw with Python1.4/Tkinter

Quote:
> I'm running Python1.4 with tkinter on Win95, and I just installed Pmw0.4.
> The demos ran fine, but I've noticed the following quirks :
> - Balloon help text appearing at the top left corner of my screen !
> - when clicking the down-arrow on a drop-down listbox, the listbox appears
> also at the top-left corner of the screen (yes the screen) !

Ah, I noticed the first one when I "ported" (= "copied" as I didn't have to
change a thing) my application-in-progress to NT (which I haven't booted up
since that joyous event). These problems don't appear under Linux, so
I guess it is a problem of the tcl/tk win32 implementation.

NEWSFLASH: While writing this, Netscape got through to:
ftp://ftp.neosoft.com/pub/tcl/sorted/devel/
and found:

 blt8.0-unoff.tgz     1217 Kb Mon Aug 25 17:33:00 1997

So, apparently there is a current blt version. Check it out.

cjr

--



Sat, 01 Apr 2000 03:00:00 GMT  
 Using Pmw with Python1.4/Tkinter

Quote:
>I'm running Python1.4 with tkinter on Win95, and I just installed Pmw0.4.
>The demos ran fine, but I've noticed the following quirks :
>- Balloon help text appearing at the top left corner of my screen !
>- when clicking the down-arrow on a drop-down listbox, the listbox appears
>also at the top-left corner of the screen (yes the screen) !

>Any advice, idea ?

The Windows version ignores the geometry request if the window
is not displayed.  Consider adding something like:

        if os.name == "nt":
            toplevel.deiconify()

to the appropriate places...

Cheers /F



Sat, 01 Apr 2000 03:00:00 GMT  
 Using Pmw with Python1.4/Tkinter

Quote:
>I do not have access to a PC so I am unable to fix this problem.  If
>anyone using Pmw under Win95 has any luck with solving it, could they
>send the patches to me and I will add them to the next release of Pmw.

>The following short script implements a simple test for the problem.
>If you can get this to work on Win95, please send me the changes.
>Under X, when the mouse enters the label, the yellow balloon window
>appears just below the label and aligned to the left hand side.

I tested this script, the poroblem appears to be in the way the two lines :
  balloon.geometry('+' + str(x) + '+' + str(y))
  balloon.deiconify()
work though x and y values are ok.
I'll try to investigate this problem deeper.
Any help appreciated.

Jerome



Sun, 02 Apr 2000 03:00:00 GMT  
 Using Pmw with Python1.4/Tkinter


Quote:
> >I'm running Python1.4 with tkinter on Win95, and I just installed Pmw0.4.
> >The demos ran fine, but I've noticed the following quirks :
> >- Balloon help text appearing at the top left corner of my screen !
> >- when clicking the down-arrow on a drop-down listbox, the listbox appears
> >also at the top-left corner of the screen (yes the screen) !

> >Any advice, idea ?

> The Windows version ignores the geometry request if the window
> is not displayed.  Consider adding something like:

>         if os.name == "nt":
>             toplevel.deiconify()

> to the appropriate places...

I do not have access to a PC so I am unable to fix this problem.  If
anyone using Pmw under Win95 has any luck with solving it, could they
send the patches to me and I will add them to the next release of Pmw.

The following short script implements a simple test for the problem.
If you can get this to work on Win95, please send me the changes.
Under X, when the mouse enters the label, the yellow balloon window
appears just below the label and aligned to the left hand side.

Thanks for any help with this.

======================================================================
import Tkinter

def showBalloon(event):
    x = target.winfo_rootx()
    y = target.winfo_rooty() + target.winfo_height()    
    balloon.geometry('+' + str(x) + '+' + str(y))
    balloon.deiconify()

def hideBalloon(event):
    balloon.withdraw()

root = Tkinter.Tk()

# Create the balloon window.
balloon = Tkinter.Toplevel(borderwidth=1, background='black')  
balloon.withdraw()
balloon.overrideredirect(1)
l = Tkinter.Label(balloon, background = 'lightyellow',
    text = 'This is a\nballoon')
l.pack()

# Create the label which has balloon help.
target = Tkinter.Label(text = 'Show/hide balloon')
target.pack()
target.bind('<Enter>', showBalloon)
target.bind('<Leave>', hideBalloon)

root.mainloop()
======================================================================

--
Greg McFarlane



Sun, 02 Apr 2000 03:00:00 GMT  
 Using Pmw with Python1.4/Tkinter

Quote:
>So the modified script is :
># Swapped lines :
>    balloon.deiconify()
>    balloon.geometry('+' + str(x) + '+' + str(y))

To avoid flashes on some displays, it could be idea to
do it like this:

    if os.name == "nt": balloon.deiconify() # Tk 8.0 bug!!!
    balloon.geometry('+' + str(x) + '+' + str(y))
    balloon.deiconify()

(I'd use "%+d%+d" % (x, y) instead of that str construct, btw,
to avoid problems with negative offsets).

Cheers /F



Sun, 02 Apr 2000 03:00:00 GMT  
 Using Pmw with Python1.4/Tkinter

With invaluable help from Fredrik, swapping the two lines :
     balloon.geometry('+' + str(x) + '+' + str(y))
     balloon.deiconify()
did it !...

/J

So the modified script is :

======================================================================
import Tkinter

def showBalloon(event):
    x = target.winfo_rootx()
    y = target.winfo_rooty() + target.winfo_height()
# Swapped lines :
    balloon.deiconify()
    balloon.geometry('+' + str(x) + '+' + str(y))

def hideBalloon(event):
    balloon.withdraw()

root = Tkinter.Tk()

# Create the balloon window.
balloon = Tkinter.Toplevel(borderwidth=1, background='black')
balloon.withdraw()
balloon.overrideredirect(1)
l = Tkinter.Label(balloon, background = 'lightyellow',
    text = 'This is a\nballoon')
l.pack()

# Create the label which has balloon help.
target = Tkinter.Label(text = 'Show/hide balloon')
target.pack()
target.bind('<Enter>', showBalloon)
target.bind('<Leave>', hideBalloon)

root.mainloop()
======================================================================

Quote:

>--
>Greg McFarlane




Sun, 02 Apr 2000 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Problems running Pmw 0.7 (Python1.5.1, Tcl/k8.1a2)

2. Problems with TKinter/Python1.5

3. Build Python1.3 for Solaris2.4 with Tkinter

4. Python1.3 & tkinter under NT

5. Python1.3 and Tkinter.py

6. pickling problems with Pmw/Tkinter

7. Anonymous tkinter/Pmw widgets?

8. Ugly little issue with Tkinter - Pmw.Counter - datatype

9. Tkinter: Strange Pmw behaviour

10. Tkinter Pmw question

11. html viewer/pane for pmw/Tkinter?

12. Changing global variables in tkinter/pmw callback

 

 
Powered by phpBB® Forum Software