From fhstoica at googlemail.com Sun Dec 8 12:18:38 2013 From: fhstoica at googlemail.com (Horace Stoica) Date: Sun, 08 Dec 2013 11:18:38 +0000 Subject: [Tkinter-discuss] Problem with event.widget.grid_info() Message-ID: <52A4558E.3090505@gmail.com> Hi, Not sure this is the place to submit such a query, please re-direct me to the correct place. I implemented a simple Lights Out game which works with the old Python 2.6 (and 2.7 in Windows). After upgrading to SUSE 13.1 which comes with Python 2.7.5 I get the following error: *Exception in Tkinter callback** **Traceback (most recent call last):** ** File "/usr/lib64/python2.7/lib-tk/Tkinter.py", line 1470, in __call__** ** return self.func(*args)** ** File "./LightsOut.py", line 28, in mouse** ** grid_info = event.widget.grid_info()** ** File "/usr/lib64/python2.7/lib-tk/Tkinter.py", line 1978, in grid_info** ** self.tk.call('grid', 'info', self._w))** **TypeError: coercing to Unicode: need string or buffer, _tkinter.Tcl_Obj found** * I get the same error with Python 3.3.2 (which also comes with SUSE 13.1). I attached the source code for the game, please run with "./LightsOut 3". Any help would be greatly appreciated. Thanks, Horace -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: LightsOut.py Type: text/x-python Size: 3206 bytes Desc: not available URL: From klappnase at web.de Sun Dec 8 21:00:39 2013 From: klappnase at web.de (Michael Lange) Date: Sun, 8 Dec 2013 21:00:39 +0100 Subject: [Tkinter-discuss] Problem with event.widget.grid_info() In-Reply-To: <52A4558E.3090505@gmail.com> References: <52A4558E.3090505@gmail.com> Message-ID: <20131208210039.6dc2f5f1a2b555de0d6399aa@web.de> Hi, On Sun, 08 Dec 2013 11:18:38 +0000 Horace Stoica wrote: > Hi, > > Not sure this is the place to submit such a query, please re-direct me > to the correct place. > I implemented a simple Lights Out game which works with the old Python > 2.6 (and 2.7 in Windows). > After upgrading to SUSE 13.1 which comes with Python 2.7.5 I get the > following error: > > *Exception in Tkinter callback** > **Traceback (most recent call last):** > ** File "/usr/lib64/python2.7/lib-tk/Tkinter.py", line 1470, in > __call__** ** return self.func(*args)** > ** File "./LightsOut.py", line 28, in mouse** > ** grid_info = event.widget.grid_info()** > ** File "/usr/lib64/python2.7/lib-tk/Tkinter.py", line 1978, in > grid_info** ** self.tk.call('grid', 'info', self._w))** > **TypeError: coercing to Unicode: need string or buffer, > _tkinter.Tcl_Obj found** > * > I get the same error with Python 3.3.2 (which also comes with SUSE > 13.1). I attached the source code for the game, please run with > "./LightsOut 3". this is a bug in the installed Tkinter version, from time to time we stumble across these TclObjects which are supposed to perform some smart automagic behind the scenes to convert the strings that are returned by calls to the Tcl interpreter into the appropriate Python object; unfortunately sometimes this fails. Here apparently such a TclObject is returned instead of a string. There are two ways to work around this: - first you can, after you identified the problematic tk call, do the TclObject to string conversion manually. Here this would probably mean that you have to override Tkinter.Grid.grid_info(). - second, and this is what I prefer, you can turn the use of TclObjects off altogether by simply calling once in your program, immediately after the first "import Tkinter" but before creating the root window, Tkinter.wantobjects = False The disadvantage herein is that you might have to do some type conversions yourself, because with wantobjects=False widget.tk.call() will always return a string and unfortunately the tkinter developers these days seem to rely on wantobjects being True. However you can be sure that once your code runs you will be on the safe side with the next Python version ;) The bad news however are that setting wantobjects to False doesn't seem to work with Python3 any longer, at least this is the case with Python 3.2.3 here on my debian wheezy system. Regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. I'm frequently appalled by the low regard you Earthmen have for life. -- Spock, "The Galileo Seven", stardate 2822.3 From storchaka at gmail.com Mon Dec 9 00:06:42 2013 From: storchaka at gmail.com (Serhiy Storchaka) Date: Mon, 09 Dec 2013 01:06:42 +0200 Subject: [Tkinter-discuss] Fixing Tkinter Message-ID: Please could somebody make a review of patches for Tkinter issues? http://bugs.python.org/issue13153 http://bugs.python.org/issue19020 From storchaka at gmail.com Mon Dec 9 00:36:04 2013 From: storchaka at gmail.com (Serhiy Storchaka) Date: Mon, 09 Dec 2013 01:36:04 +0200 Subject: [Tkinter-discuss] Problem with event.widget.grid_info() In-Reply-To: <52A4558E.3090505@gmail.com> References: <52A4558E.3090505@gmail.com> Message-ID: 08.12.13 13:18, Horace Stoica ???????(??): > Not sure this is the place to submit such a query, please re-direct me > to the correct place. Report bugs on http://bugs.python.org/. But first test last bugfix releases, perhaps this bug had fixed in 2.7.6 and 3.3.3. > I implemented a simple Lights Out game which works with the old Python > 2.6 (and 2.7 in Windows). > After upgrading to SUSE 13.1 which comes with Python 2.7.5 I get the > following error: I guess Tcl/Tk version was changed too. From ahmetcanceceloglu at hotmail.com Fri Dec 20 01:59:17 2013 From: ahmetcanceceloglu at hotmail.com (ceceloglu) Date: Thu, 19 Dec 2013 16:59:17 -0800 (PST) Subject: [Tkinter-discuss] I have a problem.. tkinter to Arduino Communication... Message-ID: <1387501157180-5042138.post@n6.nabble.com> hey guys, I'm trying to communication by using Python for working arduino project, but my tkinter program give an error! I write below my code, Anybody help me ? I have to reach this Sunday to my Prof. Best Wishes.. Ahmet Can.. #!/usr/bin/env python #-*-coding:utf-8-*- from Tkinter import * from tkMessageBox import * import ImageTk import serial import time zamanlar=[] zamanlar2=[] #global i #global k islemci=serial.Serial("COM8",9600) pencere= Tk() pencere.geometry("600x400+350+350") pencere.tk_setPalette("#FE2E64") baslik=pencere.title(u"Mini Konvey?r Projesine Ho?geldiniz") def baslat(): islemci.write("b") def durdur (): islemci.write("d") if islemci.readline()=="kucuk": okudu=1 ifade=int(kutu.get()) ifade=ifade+1 kutu.delete(0,END) kutu.insert(END,ifade) if okudu==1: i=0 a=time.ctime() zamanlar.append(a) kutu2.delete(0,END) kutu2.insert(END,zamanlar[i]) i=i+1 okudu=0 elif islemci.readline()=="buyuk": okudu2=1 ifade2=int(kutu_2.get()) ifade2=ifade2+1 kutu_2.delete(0,END) kutu_2.insert(END,ifade2) if okudu2==1: k=0 b=time.ctime() zamanlar.append(b) kutu3.delete(0,END) kutu3.insert(END,zamanlar2[k]) k=k+1 okundu2=0 elif islemci.readline()=="gunluk_doldu": showinfo("Gunluk 10 kutu S?n?r? dolmustur.Hat kapat?l?yor..") time.sleep(1) giris=Label(pencere) giris.config(text= u"***Hatt? ba?latmak i?in yandaki Butona bas?n?z!!",fg="Black",font="Times 30 italic") giris.grid(row=0, column=2) buton_1 = Button(text=u"BA?LAT",bg="black",command=baslat) buton_1.grid(row=0, column=3) giris_2=Label(pencere) giris_2.config(text= u"***Hatt? durdurmak i?in yandaki Butona bas?n?z!!",fg="Black",font="Times 30 italic") giris_2.grid(row=1, column=2) buton_2 = Button(text=u"DURDUR",bg="black",command=durdur) buton_2.grid(row=1, column=3) giris_3=Label(pencere) giris_3.config(text= u"Okunan K???k Kutu Say?s?",fg="Black",font="Times 15 italic") giris_3.grid(row=2, column=1) kutu= Text(width=10,height=3,font="Times 10 bold") kutu.grid(row=3, column=1) kutu.insert(END,0) giris_4=Label(pencere) giris_4.config(text= u"Okunan B?y?k Kutu Say?s?",fg="Black",font="Times 15 italic") giris_4.grid(row=2, column=3) kutu_2= Text(width=10,height=3,font="Times 10 bold") kutu_2.grid(row=3, column=3) kutu_2.insert(END,0) giris_5=Label(pencere) giris_5.config(text= u"Okunan K???k Kutu Tarihleri",fg="Black",font="Times 15 italic") giris_5.grid(row=4, column=1) kutu2=Listbox(bg="white") kutu2.place(relx=5, rely=5,relheight=0.16) kutu2.pack() giris_6=Label(pencere) giris_6.config(text= u"Okunan B?y?k Kutu Tarihleri",fg="Black",font="Times 15 italic") giris_6.grid(row=4, column=3) kutu3=Listbox(bg="white") kutu3.place(relx=6, rely=6,relheight=0.16) kutu3.pack() giris_6=Label(pencere) giris_6.config(text= u"NOT: G?nl?k 10 kutu s?n?r? a??ld???nda hat duracakt?r!!",fg="Black",font="Times 15 italic") giris_6.grid(row=5, column=2) mainloop() -- View this message in context: http://python.6.x6.nabble.com/I-have-a-problem-tkinter-to-Arduino-Communication-tp5042138.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. From pierre.dagenais at ncf.ca Sun Dec 22 02:10:39 2013 From: pierre.dagenais at ncf.ca (Pierre Dagenais) Date: Sat, 21 Dec 2013 20:10:39 -0500 Subject: [Tkinter-discuss] Where is tkinter.py Message-ID: <52B63C0F.2080205@ncf.ca> Hi, I'm new at this stuff and I'm trying to understand what I'm doing! I thought that when I executed "tkinter import" a file called tkinter.py (a class) would be loaded for execution. Except when I search my system, Ubuntu 12.04, all I find is Tkinter.py in the 2.7 directory, python3.3 has no equivalent tkinter.py? Can somebody explain? TU, PierreD. From nad at acm.org Sun Dec 22 02:45:38 2013 From: nad at acm.org (Ned Deily) Date: Sat, 21 Dec 2013 17:45:38 -0800 Subject: [Tkinter-discuss] Where is tkinter.py References: <52B63C0F.2080205@ncf.ca> Message-ID: In article <52B63C0F.2080205 at ncf.ca>, Pierre Dagenais wrote: > I'm new at this stuff and I'm trying to understand what I'm doing! I > thought that when I executed "tkinter import" a file called tkinter.py > (a class) would be loaded for execution. Except when I search my system, > Ubuntu 12.04, all I find is Tkinter.py in the 2.7 directory, python3.3 > has no equivalent tkinter.py? > Can somebody explain? Ubuntu chooses to package tkinter separately from Python, giving you the option to not have to pull in Tcl, Tk, and all of their dependencies if you don't need them. Try installing the python3-tk package, for example: sudo apt-get install python3-tk -- Ned Deily, nad at acm.org From guido at python.org Sun Dec 22 04:18:27 2013 From: guido at python.org (Guido van Rossum) Date: Sat, 21 Dec 2013 19:18:27 -0800 Subject: [Tkinter-discuss] Where is tkinter.py In-Reply-To: <52B63C0F.2080205@ncf.ca> References: <52B63C0F.2080205@ncf.ca> Message-ID: Typically what I do in such a case is go into the interactive Python interpreter, import the module, and then print it. E.g. for Python 2.7 on OSX: $ python Python 2.7.6+ (2.7:313d9bb253bf, Nov 25 2013, 14:05:28) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import tkinter import tkinter Traceback (most recent call last): File "", line 1, in ImportError: No module named tkinter >>> import Tkinter import Tkinter >>> Tkinter Tkinter >>> And for 3.4: $ python3 python3 Python 3.4.0b1 (v3.4.0b1:3405dc9a6afa, Nov 24 2013, 16:45:59) [GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import Tkinter import Tkinter Traceback (most recent call last): File "", line 1, in ImportError: No module named 'Tkinter' >>> import tkinter import tkinter >>> tkinter tkinter >>> On Sat, Dec 21, 2013 at 5:10 PM, Pierre Dagenais wrote: > Hi, > I'm new at this stuff and I'm trying to understand what I'm doing! I > thought that when I executed "tkinter import" a file called tkinter.py > (a class) would be loaded for execution. Except when I search my system, > Ubuntu 12.04, all I find is Tkinter.py in the 2.7 directory, python3.3 > has no equivalent tkinter.py? > Can somebody explain? > > TU, > > PierreD. > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > https://mail.python.org/mailman/listinfo/tkinter-discuss -- --Guido van Rossum (python.org/~guido) From pierre.dagenais at ncf.ca Sun Dec 22 22:22:50 2013 From: pierre.dagenais at ncf.ca (Pierre Dagenais) Date: Sun, 22 Dec 2013 16:22:50 -0500 Subject: [Tkinter-discuss] Where is tkinter.py -- Thank You All In-Reply-To: <52B63C0F.2080205@ncf.ca> References: <52B63C0F.2080205@ncf.ca> Message-ID: <52B7582A.6020105@ncf.ca> Thank you all, > > PierreD. > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > https://mail.python.org/mailman/listinfo/tkinter-discuss >