Bill Felton | 12 Apr 14:32 2012

Questions about treeview

Hi all,
Is it true that the ttk treeview widget 'swallows' right-mouse clicks?
We have a need that could be met with the treeview if we could only figure out how to get pop-up menus to work in
that widget.
Our tests seem to show that regardless of where in the containment structure one binds <button-2> (widget,
frmae, outframe, window, app), if the widget at the "bottom" of the stack is a treeview, the mouse button-2
event will not be caught.

Also, are there plans to fix the current problems with horizontal scrolling in treeviews?  We have used the
work-around of having an empty data column that the user can drag to the right; once the drag moves past the
visible bounds of the frame containing the treeview the horizontal scrollbar appears.  This seems clumsy
and un-intuitive, so we're hoping there's another, better, way to get horizontal scrolling to work.

regards,
Bill
Michael Lange | 12 Apr 16:17 2012
Picon

Re: Questions about treeview

Hi Bill,

Thus spoketh Bill Felton <subscriptions <at> cagttraining.com> 
unto us on Thu, 12 Apr 2012 08:32:58 -0400:

> Hi all,
> Is it true that the ttk treeview widget 'swallows' right-mouse clicks?
> We have a need that could be met with the treeview if we could only
> figure out how to get pop-up menus to work in that widget. Our tests
> seem to show that regardless of where in the containment structure one
> binds <button-2> (widget, frmae, outframe, window, app), if the widget
> at the "bottom" of the stack is a treeview, the mouse button-2 event
> will not be caught.

Maybe you simply confuse Button-2 (the button in the middle, under the
wheel) and Button-3 ? The following code works here just as expected:

from Tkinter import *
import ttk
root = Tk()
t = ttk.Treeview(root)
t.pack(fill='both', expand=1)

def test(event):
    print 'hi'

t.bind('<3>', test)
root.mainloop()

> 
(Continue reading)

Bill Felton | 12 Apr 17:22 2012

Re: Questions about treeview

Hi Michael,

On Apr 12, 2012, at 10:17 AM, Michael Lange wrote:
>> Is it true that the ttk treeview widget 'swallows' right-mouse clicks?
>> We have a need that could be met with the treeview if we could only
>> figure out how to get pop-up menus to work in that widget. Our tests
>> seem to show that regardless of where in the containment structure one
>> binds <button-2> (widget, frmae, outframe, window, app), if the widget
>> at the "bottom" of the stack is a treeview, the mouse button-2 event
>> will not be caught.
> 
> Maybe you simply confuse Button-2 (the button in the middle, under the
> wheel) and Button-3 ? The following code works here just as expected:
> 
> from Tkinter import *
> import ttk
> root = Tk()
> t = ttk.Treeview(root)
> t.pack(fill='both', expand=1)
> 
> def test(event):
>    print 'hi'
> 
> t.bind('<3>', test)
> root.mainloop()

I'm working on both Mac and  PC with a test for which is current, 
so using the correct button depending.
I know I've got that part right because I get pop-ups everywhere 
else I expect/need them, just not in the tree.
(Continue reading)

shoz | 13 Apr 17:23 2012
Picon

TkPhotoImage data-option

Hello, Developers

I modified Tkinter on Python 2.7 and use it every time.
Because original Tkinter dosen't execute the following code well:

f = open("apple.ppm", "rb")
pho = Tk.PhotoImage(data=f.read())

I found out what is wrong in Tkinter implement and fixed it.
That is:

*** org/_tkinter.c
--- new/_tkinter.c
***************
*** 947,954 ****
Tcl_Obj *result;

if (PyString_Check(value))
! return Tcl_NewStringObj(PyString_AS_STRING(value),
PyString_GET_SIZE(value));
else if (PyBool_Check(value))
return Tcl_NewBooleanObj(PyObject_IsTrue(value));
else if (PyInt_Check(value))
--- 947,954 ----
Tcl_Obj *result;

if (PyString_Check(value))
! return Tcl_NewByteArrayObj(PyString_AS_STRING(value),
PyString_GET_SIZE(value));
else if (PyBool_Check(value))
(Continue reading)

Monte Milanuk | 15 Apr 01:36 2012
Picon

Glade for Tkinter?

Has anyone ever considered such a beast?  

Seems like Glade continues to be popular, and it appears possible to utilize it
for other gui packages like wxpython (e.g. wxGlade)... 

Its far beyond my current (mostly nonexistent) abilities since I'm just a
beginner, so you can skip the 'great idea, go for it!' bit ;)

It just occurred to me that it might make a good idea for a summer of code
project or something like that.

Monte
Lynn Oliver | 18 Apr 22:57 2012
Picon

problem changing font settings for ttk themed widgets on Windows


On OS X, ttk.Style().configure('TLabelframe.label', font='helvetica 14 bold') works to change the font used by the ttk.LabelFrame widget. 

On Windows, ttk.Style().configure('TLabelframe.label', font='arial 14 bold') has no effect other than causing  ttk.Style().lookup('TLabelframe.label','font' to return the changed font info.

ttkButton and ttk.CheckButton also do not allow the font to be changed on Windows.  ttk.Label does allow the font to change.

I tried creating a derived style but that doesn't work either.

Changing the font setting in python27/tcl/tk8.5/ttk/xpTheme.tcl does change the font being displayed. Removing the -font TkDefaultFont setting from the theme settings does not change what is displayed or allow the font to be changed.

Any suggestions as to how this actually works?


_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss
Bharath Reddy A. | 19 Apr 17:32 2012
Picon

Tkinter GUI freezing

Hi all,
I have created a GUI using Tkinter. 
I have a button "GO", which when clicked calls a function (mainFunc).
That function takes around 60 seconds to execute and in the mean time outputs many numbers which have to be displayed in a list in the GUI.

I have attempted the following:
  1.  I created a thread whose target = mainFunc, when the button is clicked. I can see the function printing stuff in terminal. But the GUI still freezes.
  2.  When I tried to create a  thread whose target = root.mainloop(), the GUI doesn't display at all, (Python.app launches but the GUI is not displayed), 
Can you please help me how to create threads exactly???

I am attaching my code along with the mail

main. mainFunction() is the function that takes approx 60 seconds to execute and that should be running in parallel with GUI/ in background.
Thanks in advance...


Attachment (interface.py): application/octet-stream, 9 KiB
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss
Michael Lange | 19 Apr 20:36 2012
Picon

Re: Tkinter GUI freezing

Hi,

Thus spoketh "Bharath Reddy A." <bharath270392 <at> gmail.com> 
unto us on Thu, 19 Apr 2012 21:02:58 +0530:

> Hi all,
> I have created a GUI using Tkinter.
> I have a button "GO", which when clicked calls a function (mainFunc).
> That function takes around 60 seconds to execute and in the mean time
> outputs many numbers which have to be displayed in a list in the GUI.
> 
> I have attempted the following:
> 
>    1.  I created a thread whose target = mainFunc, when the button is
>    clicked. I can see the function printing stuff in terminal. But the
> GUI still freezes.
>    2.  When I tried to create a  thread whose target = root.mainloop(),
> the GUI doesn't display at all, (Python.app launches but the GUI is not
>    displayed),

One thing you must *never* do is to mix the Tkinter gui thread, which in
fact should always be the main program thread, with any child thread. If
the gui needs to reflect progress of the callbacks in the child thread,
you must never call some Tkinter methods directly from within the child
thread, but update some variable values and query them (typically
periodically) from the gui thread.

> 
> *Can you please help me how to create threads exactly???*
> 
> I am attaching my code along with the mail
> 
> main. mainFunction() is the function that takes approx 60 seconds to
> execute and that should be running in parallel with GUI/ in background.
> Thanks in advance...

The problem in your code is aparently the following line:

   thread1 = threading.Thread(target = main.mainFunction(host, uname,
                 passwd, networkPart, startHost, endHost, diction))

This way the mainFunction() call is done just when the interpreter
evaluates this line. See the library reference about Thread objects:

"class Thread(group=None, target=None, name=None, args=(), kwargs={})
  This constructor should always be called with keyword arguments.
  Arguments are: 
  group should be None; reserved for future extension when a ThreadGroup
  class is implemented. 
  target is the callable object to be invoked by the run() method.
  Defaults to None, meaning nothing is called. 
  name is the thread name. By default, a unique name is constructed of the
  form ``Thread-N'' where N is a small decimal number. 
  args is the argument tuple for the target invocation. Defaults to (). 
  kwargs is a dictionary of keyword arguments for the target invocation.
  Defaults to {}."

I hope this helps

Michael

.-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.

You go slow, be gentle.  It's no one-way street -- you know how you
feel and that's all.  It's how the girl feels too.  Don't press.  If
the girl feels anything for you at all, you'll know.
		-- Kirk, "Charlie X", stardate 1535.8
Michael O'Donnell | 20 Apr 14:05 2012
Picon
Picon

Python 3.2 and binding Mousewheel on Mac

Hi All,

  I am on Macosx Lion running Python 3.2.3 and Tkinter 8.5

The following  code breaks on my machine, and given
search on the web, has been breaking in different forms since
2005.

#========
from tkinter import *
def _onMouseWheel(event):
    print(event)

root = Tk()
root.bind('<MouseWheel>',_onMouseWheel)
root.mainloop()
#=======

On my machine works under python 2.7.2.

I thought this would be fixed by now. Does anyone know
anything about it?

Mick
Kevin Walzer | 20 Apr 14:39 2012

Re: Python 3.2 and binding Mousewheel on Mac

On 4/20/12 8:05 AM, Michael O'Donnell wrote:
> Hi All,
>
>    I am on Macosx Lion running Python 3.2.3 and Tkinter 8.5
>
> The following  code breaks on my machine, and given
> search on the web, has been breaking in different forms since
> 2005.
>
Using the similar code on 10.7.3 with Python 2.7.1, here's the output I get:

<Tkinter.Event instance at 0x10178cab8>
<Tkinter.Event instance at 0x10178cab8>
<Tkinter.Event instance at 0x10178cab8>
<Tkinter.Event instance at 0x10178cab8>
<Tkinter.Event instance at 0x10178cab8>
<Tkinter.Event instance at 0x10178cab8>
<Tkinter.Event instance at 0x10178cab8>
<Tkinter.Event instance at 0x10178cab8>
<Tkinter.Event instance at 0x10178cab8>

Seems fine to me. What are you seeing with 3.2?

--Kevin

--

-- 
Kevin Walzer
Code by Kevin
http://www.codebykevin.com

Gmane