beeline through tkinter

E

Elaine Jackson

I'm about to tackle tkinter, but here's the thing: The only kind of GUI I want
to work on is a chessboard (an 8x8 grid of images that can be "moved around").
So before I start, I'm asking the room at large: Is there some way of going
directly to what I'm interested in? Any help will be very much appreciated.

Peace
 
E

Eric Brunel

Elaine said:
I'm about to tackle tkinter, but here's the thing: The only kind of GUI I want
to work on is a chessboard (an 8x8 grid of images that can be "moved around").
So before I start, I'm asking the room at large: Is there some way of going
directly to what I'm interested in? Any help will be very much appreciated.

If you don't already have it, download the source distribution of Python and go
to the Demo/tkinter/matt sub-directory. There are many examples here that you
can use to do what you want; see for example canvas-moving-w-mouse.py

HTH
 
R

RPM1

I'm about to tackle tkinter, but here's the thing: The only kind of GUI I want
to work on is a chessboard (an 8x8 grid of images that can be "moved around").
So before I start, I'm asking the room at large: Is there some way of going
directly to what I'm interested in? Any help will be very much
appreciated.

Chess board huh? What are you going to do with a chess board and
python?

Just curious, :)
Patrick
 
L

Lonnie Princehouse

Elaine Jackson said:
I'm about to tackle tkinter, but here's the thing: The only kind of GUI I want
to work on is a chessboard (an 8x8 grid of images that can be "moved around").
So before I start, I'm asking the room at large: Is there some way of going
directly to what I'm interested in? Any help will be very much appreciated.

Peace

This isn't quite an answer to your question, but I've got exactly such
a Tkinter chessboard. It's only half-finished (I have a short
attention span for projects!), but it might give you some ideas:

http://magicpeacefarm.com/lonnie/chessboard.tar.gz

Let me know if you use it for anything interesting =)
It requires the Python Imaging Library (PIL)
 
E

Elaine Jackson

| This isn't quite an answer to your question, but I've got exactly such
| a Tkinter chessboard. It's only half-finished (I have a short
| attention span for projects!), but it might give you some ideas:
|
| http://magicpeacefarm.com/lonnie/chessboard.tar.gz

This won't unzip for me. I get a message that says "Error reading header after
processing 0 entries".
 
E

Elaine Jackson

So far I've got a script that translates a pgn file into text that can be
typeset in a chess font to produce a pictorial representation of the game in
question. With a graphical interface it will eventually evolve into a pgn
viewer/analyzer.

|
| "Elaine Jackson" wrote ...
| > I'm about to tackle tkinter, but here's the thing: The only kind of GUI I
| want
| > to work on is a chessboard (an 8x8 grid of images that can be "moved
| around").
| > So before I start, I'm asking the room at large: Is there some way of
| going
| > directly to what I'm interested in? Any help will be very much
| appreciated.
|
| Chess board huh? What are you going to do with a chess board and
| python?
|
| Just curious, :)
| Patrick
|
|
|
 
E

Elaine Jackson

| If you don't already have it, download the source distribution of Python and
go
| to the Demo/tkinter/matt sub-directory. There are many examples here that you
| can use to do what you want; see for example canvas-moving-w-mouse.py

I don't know where to obtain this. Searching python.org with the phrase 'python
source distribution' turns up a bunch of stuff about using distutils.
 
R

RPM1

Elaine Jackson said:
So far I've got a script that translates a pgn file into text that can be
typeset in a chess font to produce a pictorial representation of the game in
question. With a graphical interface it will eventually evolve into a pgn
viewer/analyzer.

Cool. Over the years I've tinkered with very basic chess programs
written in various programming languages. I found python to be too
slow, (although I wonder if Numeric or Psyco might make it feasible).

There is a chess program written in python:

http://www.kolumbus.fi/jyrki.alakuijala/pychess.html

but it is very slow and pretty weak.

Good luck with the viewer,
Patrick
 
L

Lonnie Princehouse

Elaine Jackson said:
| This isn't quite an answer to your question, but I've got exactly such
| a Tkinter chessboard. It's only half-finished (I have a short
| attention span for projects!), but it might give you some ideas:
|
| http://magicpeacefarm.com/lonnie/chessboard.tar.gz

This won't unzip for me. I get a message that says "Error reading header after
processing 0 entries".

Ah, the joys of Windows! I'll put up a zipped version-

http://magicpeacefarm.com/lonnie/chessboard.zip

I've noticed that Windows likes to add another ".tar" when it
downloads tar/gzipped archives, and at least Winzip can't figure it
out. You can usually fix this by renaming the file to have a
".tar.gz" extension instead of ".tar.gz.tar". This isn't at all
obvious if you have show-extensions turned off.

-L
 
L

Lonnie Princehouse

Yes, Python is probably too slow for a competitive chess engine.
Pychess works, but it's about two orders of magnitude slower than it
would be in C. I haven't tried it with Psyco; that might help
considerably.

That said, it's a breeze to write C extensions for Python. It makes a
lot of sense to write the GUI in Python and have the crunchy bits in
C.

(It took me a few hours to write the chess board GUI posted in this
thread, and it would have taken a lot longer in C, not to mention the
portability advantage of an interpreted language)
 
J

Jorgen Grahn

| If you don't already have it, download the source distribution of Python and
go
| to the Demo/tkinter/matt sub-directory. There are many examples here that you
| can use to do what you want; see for example canvas-moving-w-mouse.py

I don't know where to obtain this. Searching python.org with the phrase 'python
source distribution' turns up a bunch of stuff about using distutils.

Sometimes you cannot just search, you have to think as well.
http://www.python.org/download/ , near the top of the screen:

http://www.python.org/ftp/python/2.3.3/Python-2.3.3.tgz

/Jorgen
 
R

RPM1

Lonnie Princehouse said:
Yes, Python is probably too slow for a competitive chess engine.
Pychess works, but it's about two orders of magnitude slower than it
would be in C. I haven't tried it with Psyco; that might help
considerably.

That said, it's a breeze to write C extensions for Python. It makes a
lot of sense to write the GUI in Python and have the crunchy bits in
C.

Yeah but there are already GUI's, (Winboard and Arena), that you can
run various chess engines in. That negates the need to write the GUI
part, so you're just left with the engine in C.

I've written move generators in Python, (with Psyco), and they achieve
speeds around 10,000 - 20,000 nodes per second on a machine where
C code can do 300,000 - 500,000 nodes per second. Java and C#
were around 80,000 - 120,000.

Of course the trick with Python is to *not* wrte a straight port of C code
but to use the built in functionality of Python to some kind of advantage.
I have not achieved that yet.

Patrick
 
E

Elaine Jackson

That's got it. Thanks very much.

| > | >
| > | This isn't quite an answer to your question, but I've got exactly such
| > | a Tkinter chessboard. It's only half-finished (I have a short
| > | attention span for projects!), but it might give you some ideas:
| > |
| > | http://magicpeacefarm.com/lonnie/chessboard.tar.gz
| >
| > This won't unzip for me. I get a message that says "Error reading header
after
| > processing 0 entries".
|
| Ah, the joys of Windows! I'll put up a zipped version-
|
| http://magicpeacefarm.com/lonnie/chessboard.zip
|
| I've noticed that Windows likes to add another ".tar" when it
| downloads tar/gzipped archives, and at least Winzip can't figure it
| out. You can usually fix this by renaming the file to have a
| ".tar.gz" extension instead of ".tar.gz.tar". This isn't at all
| obvious if you have show-extensions turned off.
|
| -L
 
A

Alejandro López-Valencia

If you don't already have it, download the source distribution of Python and go
to the Demo/tkinter/matt sub-directory. There are many examples here that you
can use to do what you want; see for example canvas-moving-w-mouse.py

Even better yet (each command goes in a single line):

prompt> cvs -d:pserver:[email protected]:/cvsroot/python
login

[hit Enter Key when prompeted for a password]

prompt> cvs -z3
-d:pserver:[email protected]:/cvsroot/python checkout -d
python_demo_scripts -P dist/src/Demo

prompt> cvs -z3
-d:pserver:[email protected]:/cvsroot/python checkout -d
python_tool_scripts -P dist/src/Tools

And you'll have more examples than you can shake a stick at. Beats
downloading an 8 Mb tarball compressed with bzip2 at any rate.

If you are CVS challenged (not surprising if you haven't used anything
but Windows or MacOS during the duration of your natural life), go to
http://www.wincvs.org/ and download the GUI client and to
http://cvs.cvshome.org/ for a copy of the CVS book.

Alejo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,183
Messages
2,570,965
Members
47,513
Latest member
JeremyLabo

Latest Threads

Top