From chris_roysmith at internode.on.net Mon Sep 1 04:46:53 2014 From: chris_roysmith at internode.on.net (Chris Roy-Smith) Date: Mon, 01 Sep 2014 12:46:53 +1000 Subject: [Tkinter-discuss] Problem using StringVar() Message-ID: <5403DE1D.6050800@internode.on.net> Just trying to learn to use Tkinter. python 2.7.3 OS Ubuntu 12.4 This code ----------------------- #!/usr/bin/python import Tkinter top = Tkinter.Tk() v = top.StringVar() Label(master, textvariable=v).pack() v.set("hello") top.mainloop() --------------------------- returns this error message Traceback (most recent call last): File "./hello.py", line 5, in v = top.StringVar() File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1767, in __getattr__ return getattr(self.tk, attr) AttributeError: StringVar Please what am I doing wrong? From michael.odonnell at uam.es Mon Sep 1 09:16:00 2014 From: michael.odonnell at uam.es (Michael O'Donnell) Date: Mon, 1 Sep 2014 09:16:00 +0200 Subject: [Tkinter-discuss] Problem using StringVar() In-Reply-To: <5403DE1D.6050800@internode.on.net> References: <5403DE1D.6050800@internode.on.net> Message-ID: Dear Chris, StringVar is a method in the module Tkinter, it is not a method of a Tk instance. Also, you reference an undefined "master" in the Label line. Thus, the following should work: from Tkinter import Tk, StringVar, Label top =Tk() v = StringVar() Label(top, textvariable=v).pack() v.set("hello") top.mainloop() Mick On 1 September 2014 04:46, Chris Roy-Smith wrote: > Just trying to learn to use Tkinter. > > python 2.7.3 OS Ubuntu 12.4 > > This code > ----------------------- > #!/usr/bin/python > import Tkinter > top = Tkinter.Tk() > > v = top.StringVar() > Label(master, textvariable=v).pack() > > v.set("hello") > > top.mainloop() > --------------------------- > returns this error message > > Traceback (most recent call last): > File "./hello.py", line 5, in > v = top.StringVar() > File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1767, in __getattr__ > return getattr(self.tk, attr) > AttributeError: StringVar > > > Please what am I doing wrong? > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > https://mail.python.org/mailman/listinfo/tkinter-discuss From chris_roysmith at internode.on.net Mon Sep 1 04:46:53 2014 From: chris_roysmith at internode.on.net (Chris Roy-Smith) Date: Mon, 01 Sep 2014 12:46:53 +1000 Subject: [Tkinter-discuss] Problem using StringVar() Message-ID: <5403DE1D.6050800@internode.on.net> Just trying to learn to use Tkinter. python 2.7.3 OS Ubuntu 12.4 This code ----------------------- #!/usr/bin/python import Tkinter top = Tkinter.Tk() v = top.StringVar() Label(master, textvariable=v).pack() v.set("hello") top.mainloop() --------------------------- returns this error message Traceback (most recent call last): File "./hello.py", line 5, in v = top.StringVar() File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1767, in __getattr__ return getattr(self.tk, attr) AttributeError: StringVar Please what am I doing wrong? From chris_roysmith at internode.on.net Mon Sep 1 09:47:54 2014 From: chris_roysmith at internode.on.net (Chris Roy-Smith) Date: Mon, 01 Sep 2014 17:47:54 +1000 Subject: [Tkinter-discuss] Problem using StringVar() In-Reply-To: References: <5403DE1D.6050800@internode.on.net> Message-ID: <540424AA.7020300@internode.on.net> On 01/09/14 17:16, Michael O'Donnell wrote: > from Tkinter import Tk, StringVar, Label > top =Tk() > v = StringVar() > Label(top, textvariable=v).pack() > v.set("hello") > top.mainloop() Thanks for the pointer. The tutorial I was working through did not explain where the StringVar() came from, and showed what I now understand as a code snippet. From jevan at freenet.de Fri Sep 12 05:32:33 2014 From: jevan at freenet.de (jevan at freenet.de) Date: Fri, 12 Sep 2014 05:32:33 +0200 Subject: [Tkinter-discuss] Cursor Index From Tkinter.Text in Gives Insconsistent Column, Test Case Message-ID: I want to get the cursor position (line and column) of the insertion point of a Tkinter.Text, but you may assume the answer is easy until you run this simple test run.? Acutally I hope someone finds it easy. PROBLEM: My text editor project requires a custom undo/redo for Tkinter.Text. I put in the same string for both Test One and Test Two below, but undo does not act consistently due to a inconsistent column variable in KeyRelease event handler given by Tkinter. The problem seems to be that I type too fast for second test which produces a bad column value. Can you help me find the problem? TWO TEST PROCESS TO REPRODUCE THE ERROR: TEST ONE ??????? Type this string slowly: 'one two three' ??????? Press F1 to see each word undo. ??? Result: Works fine. (For me atleast. Ephasis: type slowly.) TEST TWO ??????? Type the same string as fast as you can: 'one two three' ??????? Press F1 to see each word undo. ??? Result: Gets the wrong column and does not undo properly. (Restart script and repeat this step if you don't see the error at first, it sometimes works fine with fast typing. I usually get it with 3 to 4 tries at the most.) QUESTION: Is this a bug in Tkinter, or am I not understanding something specific within Tkinter that would produce consistent columns for my undo/redo records? from Tkinter import * class TextView(Text): ??? def __init__(self, root): ??????? Text.__init__(self, root) ??????? self.history = History(self) ??????? self.bind("", self.keyRelease) ??????? # used to capture a char at a time in keyRelease.? If space char is pressed it , self.word) if __name__ == "__main__": ??? root = Tk() ??? root.geometry("400x200+0+0") ??? textView = TextView(root) ??? textView.pack() ??? root.bind("", textView.undo) ??? root.bind("", textView.redo) ??? root.mainloop() --- Alle Postf?cher an einem Ort. Jetzt wechseln und E-Mail-Adresse mitnehmen! Rundum gl?cklich mit freenetMail -------------- next part -------------- An HTML attachment was scrubbed... URL: From klappnase at web.de Sat Sep 13 17:56:17 2014 From: klappnase at web.de (Michael Lange) Date: Sat, 13 Sep 2014 17:56:17 +0200 Subject: [Tkinter-discuss] Cursor Index From Tkinter.Text in Gives Insconsistent Column, Test Case In-Reply-To: References: Message-ID: <20140913175617.729a682aa9b8d0c900dcf023@web.de> Hi, On Fri, 12 Sep 2014 05:32:33 +0200 jevan at freenet.de wrote: (...) > TEST ONE > > ??????? Type this string slowly: 'one two three' > ??????? Press F1 to see each word undo. > > ??? Result: Works fine. (For me atleast. Ephasis: type slowly.) > > TEST TWO > > ??????? Type the same string as fast as you can: 'one two three' > ??????? Press F1 to see each word undo. > (...) > from Tkinter import * > > class TextView(Text): > > ??? def __init__(self, root): > ??????? Text.__init__(self, root) > > ??????? self.history = History(self) > ??????? self.bind("", self.keyRelease) > > ??????? # used to capture a char at a time in keyRelease.? If space > char is pressed it , self.word) > > if __name__ == "__main__": > ??? root = Tk() > ??? root.geometry("400x200+0+0") > > ??? textView = TextView(root) > ??? textView.pack() > ??? root.bind("", textView.undo) > ??? root.bind("", textView.redo) > > ??? root.mainloop() Looks like there is something missing here :-) Could you please post a short but complete code example that exhibits the problem? Regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. Peace was the way. -- Kirk, "The City on the Edge of Forever", stardate unknown From muratetm at gmail.com Mon Sep 15 16:22:43 2014 From: muratetm at gmail.com (Michael Muratet) Date: Mon, 15 Sep 2014 09:22:43 -0500 Subject: [Tkinter-discuss] Can't find tkInter components to build tktreectrl Message-ID: <4D889829-D6CF-4BAC-9D4B-CCD427E2CFB8@gmail.com> Greetings I am trying to build the extension tktreectrl-2.4.1 so I can call it from python. It took me awhile to sort out versions, but I think the version I want is under /anaconda ./configure --with-tk=/anaconda/pkgs/tk-8.5.13-1/lib --with-tcl=/anaconda/pkgs/tk-8.5.13-1/lib it finds tkConfig.sh and tclConfig.sh Michaels-MacBook-Pro:tktreectrl-2.4.1 mmuratet$ ./configure --with-tk=/anaconda/pkgs/tk-8.5.13-1/lib --with-tcl=/anaconda/pkgs/tk-8.5.13-1/lib checking for correct TEA configuration... ok (TEA 3.9) configure: configuring treectrl 2.4 checking for Tcl configuration... found /anaconda/pkgs/tk-8.5.13-1/lib/tclConfig.sh checking for existence of /anaconda/pkgs/tk-8.5.13-1/lib/tclConfig.sh... loading checking for Tk configuration... found /anaconda/pkgs/tk-8.5.13-1/lib/tkConfig.sh checking for existence of /anaconda/pkgs/tk-8.5.13-1/lib/tkConfig.sh... loading configure: --prefix defaulting to TCL_PREFIX /opt/anaconda1anaconda2anaconda3 configure: --exec-prefix defaulting to TCL_EXEC_PREFIX /opt/anaconda1anaconda2anaconda3 checking for a BSD-compatible install... /usr/bin/install -c checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking how to run the C preprocessor... gcc -E checking whether make sets $(MAKE)... yes checking for ranlib... ranlib checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking if the compiler understands -pipe... yes checking whether byte ordering is bigendian... no checking for sin... yes checking for main in -lieee... no checking for main in -linet... no checking net/errno.h usability... no checking net/errno.h presence... no checking for net/errno.h... no checking for connect... yes checking for gethostbyname... yes checking dirent.h... yes checking errno.h usability... yes checking errno.h presence... yes checking for errno.h... yes checking float.h usability... yes checking float.h presence... yes checking for float.h... yes checking values.h usability... no checking values.h presence... no checking for values.h... no checking limits.h usability... yes checking limits.h presence... yes checking for limits.h... yes checking for stdlib.h... (cached) yes checking for string.h... (cached) yes checking sys/wait.h usability... yes checking sys/wait.h presence... yes checking for sys/wait.h... yes checking dlfcn.h usability... yes checking dlfcn.h presence... yes checking for dlfcn.h... yes checking sys/param.h usability... yes checking sys/param.h presence... yes checking for sys/param.h... yes checking for Tcl public headers... /anaconda/pkgs/tk-8.5.13-1/lib/../include checking for Tcl private include files... Using -I"-------src-dir--------/tcl8.5.13/generic" -I"-------src-dir--------/tcl8.5.13/unix" checking for Tk public headers... /anaconda/pkgs/tk-8.5.13-1/lib/../include checking for Tk private include files... Using -I"-------src-dir--------/tk8.5.13/generic" -I"-------src-dir--------/tk8.5.13/unix" checking for X... libraries /usr/X11/lib, headers checking for X11 header files... checking whether byte ordering is bigendian... (cached) no checking for intptr_t... yes checking for pthread_mutex_init in -lpthread... yes checking for building with threads... yes (default) configure: WARNING: --enable-threads requested, but building against a Tcl that is NOT thread-enabled. This is an OK configuration that will also run in a thread-enabled core. checking how to build libraries... shared checking if 64bit support is requested... no checking if 64bit Sparc VIS support is requested... no checking if compiler supports visibility "hidden"... yes checking if rpath support is requested... yes checking system version... Darwin-11.4.2 checking for ar... ar checking if ld accepts -single_module flag... yes checking if ld accepts -search_paths_first flag... yes checking for required early compiler flags... none checking for 64-bit integer type... using long checking for build with symbols... no checking for tclsh... /anaconda/pkgs/tk-8.5.13-1/bin/tclsh8.5 checking for wish... /anaconda/pkgs/tk-8.5.13-1/bin/wish8.5 configure: creating ./config.status config.status: creating Makefile But make fails Michaels-MacBook-Pro:tktreectrl-2.4.1 mmuratet$ sudo make Password: gcc -DPACKAGE_NAME=\"treectrl\" -DPACKAGE_TARNAME=\"treectrl\" -DPACKAGE_VERSION=\"2.4\" -DPACKAGE_STRING=\"treectrl\ 2.4\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE_PATCHLEVEL=\"2.4.1\" -DBUILD_treectrl=/\*\*/ -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DNO_VALUES_H=1 -DHAVE_LIMITS_H=1 -DHAVE_SYS_PARAM_H=1 -DHAVE_INTPTR_T=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DTCL_THREADS=1 -DMODULE_SCOPE=extern\ __attribute__\(\(__visibility__\(\"hidden\"\)\)\) -DTCL_WIDE_INT_IS_LONG=1 -DUSE_TCL_STUBS=1 -DUSE_TK_STUBS=1 -I. -I"./generic" -I"-------src-dir--------/tcl8.5.13/generic" -I"-------src-dir--------/tcl8.5.13/unix" -I"-------src-dir--------/tk8.5.13/generic" -I"-------src-dir--------/tk8.5.13/unix" -pipe -Os -Wall -fno-common -c `echo ./generic/qebind.c` -o qebind.o gcc -DPACKAGE_NAME=\"treectrl\" -DPACKAGE_TARNAME=\"treectrl\" -DPACKAGE_VERSION=\"2.4\" -DPACKAGE_STRING=\"treectrl\ 2.4\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE_PATCHLEVEL=\"2.4.1\" -DBUILD_treectrl=/\*\*/ -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DNO_VALUES_H=1 -DHAVE_LIMITS_H=1 -DHAVE_SYS_PARAM_H=1 -DHAVE_INTPTR_T=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DTCL_THREADS=1 -DMODULE_SCOPE=extern\ __attribute__\(\(__visibility__\(\"hidden\"\)\)\) -DTCL_WIDE_INT_IS_LONG=1 -DUSE_TCL_STUBS=1 -DUSE_TK_STUBS=1 -I. -I"./generic" -I"-------src-dir--------/tcl8.5.13/generic" -I"-------src-dir--------/tcl8.5.13/unix" -I"-------src-dir--------/tk8.5.13/generic" -I"-------src-dir--------/tk8.5.13/unix" -pipe -Os -Wall -fno-common -c `echo ./generic/tkTreeColumn.c` -o tkTreeColumn.o In file included from ./generic/tkTreeColumn.c:11:0: ./generic/tkTreeCtrl.h:11:20: fatal error: tkPort.h: No such file or directory compilation terminated. make: *** [tkTreeColumn.o] Error 1 I'm not sure where to go from here. If tkConfig.sh and tclConfig.sh don't know where the headers are, where would you look for headers? There is no tkPort.h anywhere under /anaconda I've never seen configure generate include paths with a lot of hyphens. Is that coming from tkConf.sh or tclConf.sh? Thanks Mike From lutz at rmi.net Fri Sep 26 20:45:49 2014 From: lutz at rmi.net (Mark Lutz) Date: Fri, 26 Sep 2014 18:45:49 -0000 Subject: [Tkinter-discuss] tkinter on android? Message-ID: <3j4LFz03p5z7Lky@mail.python.org> Has there been any work on porting tkinter to Android yet? The usual searches come up empty, but the following looks like a promising development in the Tcl/Tk front: http://www.androwish.org/index.html/home and there may be a few usable Python 2.X and 3.X Android ports to build on ("Python for Android" search results turn up SL4A, QPython, and others). This may or may not be feasible, but there are a lot of tkinter GUIs which would be great to have on an Android device; personally, I have tkinter-based text editors, clocks, email clients, calculators, and now calendars that see daily action elsewhere. Thanks, --Mark Lutz (http://learning-python.com, http://www.rmi.net/~lutz)