contro opinion | 1 Jul 2012 08:52
Picon

how to use tkinter in python3.2

1.i have installed tk
2.install python3.1 and  python3.2 the sameway
1)download
2)./configure
3)make
4)make install

in my console


tiger <at> ocean:~$ python3.2
Python 3.2.3 (default, Jul  1 2012, 11:07:14)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.2/tkinter/__init__.py", line 39, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter
>>>

tiger <at> ocean:~$ python3.1
Python 3.1.3 (r313:86834, Nov 28 2010, 11:28:10)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
>>>
what is the matter?
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss
psao pollard-flamand | 1 Jul 2012 11:22

Re: how to use tkinter in python3.2

The module name is Tkinter not tkinter...
From: contro opinion
Sent: 30/06/2012 11:53 PM
To: Tkinter-discuss
Subject: [Tkinter-discuss] how to use tkinter in python3.2

1.i have installed tk
2.install python3.1 and  python3.2 the sameway
1)download
2)./configure
3)make
4)make install

in my console


tiger <at> ocean:~$ python3.2
Python 3.2.3 (default, Jul  1 2012, 11:07:14)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.2/tkinter/__init__.py", line 39, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter
>>>

tiger <at> ocean:~$ python3.1
Python 3.1.3 (r313:86834, Nov 28 2010, 11:28:10)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
>>>
what is the matter?
_______________________________________________
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
Michael Lange | 1 Jul 2012 13:08
Picon

Re: how to use tkinter in python3.2

Thus spoketh psao pollard-flamand <psaoflamand <at> live.com> 
unto us on Sun, 1 Jul 2012 02:22:31 -0700:

> The module name is Tkinter not tkinter...

Not in Python3, tkinter is correct.

> ________________________________
> From: contro opinion
> Sent: 30/06/2012 11:53 PM
> To: Tkinter-discuss
> Subject: [Tkinter-discuss] how to use tkinter in python3.2
> 
> 1.i have installed tk
> 2.install python3.1 and  python3.2 the sameway
> 1)download
> 2)./configure
> 3)make
> 4)make install
> 
> in my console
> 
> 
> tiger <at> ocean:~$ python3.2
> Python 3.2.3 (default, Jul  1 2012, 11:07:14)
> [GCC 4.4.5] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import tkinter
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/usr/local/lib/python3.2/tkinter/__init__.py", line 39, in
> <module> import _tkinter # If this fails your Python may not be
> configured for Tk ImportError: No module named _tkinter
> >>>
> 
> tiger <at> ocean:~$ python3.1
> Python 3.1.3 (r313:86834, Nov 28 2010, 11:28:10)
> [GCC 4.4.5] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import tkinter
> >>>
> what is the matter?

Apparently in Python-3.2 ./configure failed to detect the Tcl/Tk install.
Maybe something on your system was changed in between the install of 3.1
and 3.2 ?
We had a similar discussion here a while ago:
http://mail.python.org/pipermail/tkinter-discuss/2012-June/003203.html

Unfortunately there do not seem to be much resources helping with these
kind of problems, I encountered them myself, too, and never came to a
really satisfying solution.
If ./configure fails to find tcl/tk while all the libs and header files
are properly installed, usually the paths pointing to tclConfig.sh and
tkConfig.sh must be added to some environment variable like
LD_LIBRARY_PATH or LIBDIR , maybe the the paths to tcl.h and tk.h must
also be explicitely added to some other environment variable.
Alas there does not seem to be the one solution that works in any case,
at least I never saw it.

Regards

Michael

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

You're too beautiful to ignore.  Too much woman.
		-- Kirk to Yeoman Rand, "The Enemy Within", stardate
                   unknown
Michael O'Donnell | 2 Jul 2012 00:38
Picon
Picon
Favicon

Re: how to use tkinter in python3.2

Try installing the ActivePython installation, and which has
TCL/TK installed. They do not need to be installed separately
in any case, both the ActivePython and official releases include
all libraries needed for tkinter.

Mick

On Sun, Jul 1, 2012 at 9:08 PM, Michael Lange <klappnase <at> web.de> wrote:
> Thus spoketh psao pollard-flamand <psaoflamand <at> live.com>
> unto us on Sun, 1 Jul 2012 02:22:31 -0700:
>
>> The module name is Tkinter not tkinter...
>
> Not in Python3, tkinter is correct.
>
>> ________________________________
>> From: contro opinion
>> Sent: 30/06/2012 11:53 PM
>> To: Tkinter-discuss
>> Subject: [Tkinter-discuss] how to use tkinter in python3.2
>>
>> 1.i have installed tk
>> 2.install python3.1 and  python3.2 the sameway
>> 1)download
>> 2)./configure
>> 3)make
>> 4)make install
>>
>> in my console
>>
>>
>> tiger <at> ocean:~$ python3.2
>> Python 3.2.3 (default, Jul  1 2012, 11:07:14)
>> [GCC 4.4.5] on linux2
>> Type "help", "copyright", "credits" or "license" for more information.
>> >>> import tkinter
>> Traceback (most recent call last):
>>   File "<stdin>", line 1, in <module>
>>   File "/usr/local/lib/python3.2/tkinter/__init__.py", line 39, in
>> <module> import _tkinter # If this fails your Python may not be
>> configured for Tk ImportError: No module named _tkinter
>> >>>
>>
>> tiger <at> ocean:~$ python3.1
>> Python 3.1.3 (r313:86834, Nov 28 2010, 11:28:10)
>> [GCC 4.4.5] on linux2
>> Type "help", "copyright", "credits" or "license" for more information.
>> >>> import tkinter
>> >>>
>> what is the matter?
>
> Apparently in Python-3.2 ./configure failed to detect the Tcl/Tk install.
> Maybe something on your system was changed in between the install of 3.1
> and 3.2 ?
> We had a similar discussion here a while ago:
> http://mail.python.org/pipermail/tkinter-discuss/2012-June/003203.html
>
> Unfortunately there do not seem to be much resources helping with these
> kind of problems, I encountered them myself, too, and never came to a
> really satisfying solution.
> If ./configure fails to find tcl/tk while all the libs and header files
> are properly installed, usually the paths pointing to tclConfig.sh and
> tkConfig.sh must be added to some environment variable like
> LD_LIBRARY_PATH or LIBDIR , maybe the the paths to tcl.h and tk.h must
> also be explicitely added to some other environment variable.
> Alas there does not seem to be the one solution that works in any case,
> at least I never saw it.
>
> Regards
>
> Michael
>
>
> .-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.
>
> You're too beautiful to ignore.  Too much woman.
>                 -- Kirk to Yeoman Rand, "The Enemy Within", stardate
>                    unknown
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss <at> python.org
> http://mail.python.org/mailman/listinfo/tkinter-discuss

--

-- 

Not sent from my iPhone
mid.tier | 5 Jul 2012 08:17
Picon

pytkapp - python package to develop a simple application (MDI/SDI) using tkinter library.

Good day,

I uploaded initial release for pytkapp package (former pytkmdiapp) for
fast develop tkinter-based application with MDI/SDI interface.

Features:
Tested under python 2.6, 2.7, 3.1
Platform-independent (testing on win xp, 7, ubuntu, fedora)
Contains set of useful (on my view ;-)) widgets and tools
Contains updated tablelist wrapper for tcl package tablelist
(http://www.nemethi.de)

You can download package from PyPi: http://pypi.python.org/pypi/pytkapp
Mark Summerfield | 12 Jul 2012 12:38

Toggle buttons

Hi,

I want to create a toggle button, i.e., a button that when clicked goes
down (if it is up) and goes up (if it is down).

One easy way to achieve this is to set the button's style to
"Toolbutton" (see self.toggle2). But unfortunately, that gets rid of the
button's relief so it looks out of place amongst other non-toggling
buttons.

I solved if for Linux using a custom style (see self.toggle3). But this
doesn't work on Windows and I can't figure out how to solve it.

Can anyone suggest a solution?

Here's the code I've got:

############################################################
import tkinter.ttk

class Window(tkinter.ttk.Frame):

    def __init__(self, master=None):
        super().__init__(master)
        self.toggle1 = tkinter.ttk.Button(text="Off",
                command=lambda *args: self.toggle(self.toggle1))
        self.toggle1.pack(padx=5, pady=5)
        self.toggle2 = tkinter.ttk.Button(text="Off", style="Toolbutton",
                command=lambda *args: self.toggle(self.toggle2))
        self.toggle2.pack(padx=5, pady=5)
        self.toggle3 = tkinter.ttk.Button(text="Off", 
                command=lambda *args: self.toggle(self.toggle3))
        self.toggle3.pack(padx=5, pady=5)
        style = tkinter.ttk.Style()
        style.configure("Toggle.TButton")
        style.map("Toggle.TButton", relief=[("pressed", "sunken"),
            ("selected", "sunken"), ("!selected", "raised")])
        self.toggle3.config(style="Toggle.TButton")
        tkinter.ttk.Button(text="Quit",
                command=self.master.destroy).pack(padx=5, pady=5)
        self.pack()

    def toggle(self, button):
        if button.instate(("!selected",)):
            button.state(("selected",))
            button.config(text="On")
        else:
            button.state(("!selected",))
            button.config(text="Off")

window = Window()
window.master.title("Toggle")
window.master.mainloop()
############################################################

Thanks!

--

-- 
Mark Summerfield, Qtrac Ltd, www.qtrac.eu
    C++, Python, Qt, PyQt - training and consultancy
        "Programming in Python 3" - ISBN 0321680561
            http://www.qtrac.eu/py3book.html
Michael Lange | 12 Jul 2012 19:13
Picon

Re: Toggle buttons

Hi,

Thus spoketh Mark Summerfield <list <at> qtrac.plus.com> 
unto us on Thu, 12 Jul 2012 11:38:37 +0100:

> Hi,
> 
> I want to create a toggle button, i.e., a button that when clicked goes
> down (if it is up) and goes up (if it is down).
> 
> One easy way to achieve this is to set the button's style to
> "Toolbutton" (see self.toggle2). But unfortunately, that gets rid of the
> button's relief so it looks out of place amongst other non-toggling
> buttons.
> 
> I solved if for Linux using a custom style (see self.toggle3). But this
> doesn't work on Windows and I can't figure out how to solve it.
> 
> Can anyone suggest a solution?

Maybe you could use a Checkbutton with indicatoron=False, as in:

import tkinter

root = tkinter.Tk()

def toggle(button, variable):
    if variable.get():
        button.config(text='On')
    else:
        button.config(text='Off')

v1 = tkinter.BooleanVar()
v1.set(False)
b1 = tkinter.Checkbutton(root, text='Off', variable=v1, indicatoron=False,
                         selectcolor='', command=lambda : toggle(b1, v1))
b1.pack(padx=50, pady=50)

root.mainloop()

The button in this example looks tiny compared to a Button(), but this
could probably easily be fixed. Unfortunately there does not seem to be a
indicatoron Option for the ttk.Checkbutton though, and I am not sure how
good or bad this will look on windows.

Regards

Michael

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

You!  What PLANET is this!
		-- McCoy, "The City on the Edge of Forever", stardate
                   3134.0
Mark Summerfield | 13 Jul 2012 09:35

Re: Toggle buttons

Hi Michael,

On Thu, 12 Jul 2012 19:13:36 +0200
Michael Lange <klappnase <at> web.de> wrote:
> Hi,
> 
> Thus spoketh Mark Summerfield <list <at> qtrac.plus.com> 
> unto us on Thu, 12 Jul 2012 11:38:37 +0100:
> 
> > Hi,
> > 
> > I want to create a toggle button, i.e., a button that when clicked goes
> > down (if it is up) and goes up (if it is down).
> > 
> > One easy way to achieve this is to set the button's style to
> > "Toolbutton" (see self.toggle2). But unfortunately, that gets rid of
> > the button's relief so it looks out of place amongst other non-toggling
> > buttons.
> > 
> > I solved if for Linux using a custom style (see self.toggle3). But this
> > doesn't work on Windows and I can't figure out how to solve it.
> > 
> > Can anyone suggest a solution?
> 
> Maybe you could use a Checkbutton with indicatoron=False, as in:
> 
> import tkinter
> 
> root = tkinter.Tk()
> 
> def toggle(button, variable):
>     if variable.get():
>         button.config(text='On')
>     else:
>         button.config(text='Off')
> 
> v1 = tkinter.BooleanVar()
> v1.set(False)
> b1 = tkinter.Checkbutton(root, text='Off', variable=v1,
> indicatoron=False, selectcolor='', command=lambda : toggle(b1, v1))
> b1.pack(padx=50, pady=50)
> 
> root.mainloop()
> 
> The button in this example looks tiny compared to a Button(), but this
> could probably easily be fixed. Unfortunately there does not seem to be a
> indicatoron Option for the ttk.Checkbutton though, and I am not sure how
> good or bad this will look on windows.

Unfortunately it looks bad on Windows because using tkinter.Checkbutton
rather than tkinter.ttk.Checkbutton means you get a button that isn't
styled so it looks completely different from the others.

I'll probably use "on" and "off" images on Windows.

Thanks!

--

-- 
Mark Summerfield, Qtrac Ltd, www.qtrac.eu
    C++, Python, Qt, PyQt - training and consultancy
        "Advanced Qt Programming" - ISBN 0321635906
            http://www.qtrac.eu/aqpbook.html
Markus Holub | 13 Jul 2012 17:56
Favicon

pybwidget notebook bug

'delete' is defined twice in the NoteBook class.
Moreover the second definition misses the 'destroyframe' argument, 
making this argument unusable.

The 'delete' call in 'getframe' seems also incorrect.

Regards,
Markus
Michael O'Donnell | 23 Jul 2012 03:22
Picon
Picon
Favicon

hierarchical version of ttk.combobox

Hi All,

  Is there some widget that can give me a hierarchical popup menu
similar to ttk.combobox,  but with each item opening a submenu?

Mick

Gmane