TKinter

2005-02-27 Thread anthonyberet
So, is it pronounced 'Tee-Kinter', or 'Tee-Kay-Inter'?
I don't want to appear as a dork down the pub.
--
http://mail.python.org/mailman/listinfo/python-list


Tkinter

2006-01-10 Thread Rodrigues, Joseph








Hi,

I was referred to you by another python forum:

 

 

I would like to know if Tkinter is being
developed/maintained.  It

> appears the latest book on Tkinter by John E.
Grayson published in 2000

> is the only book resource on Tkinter.

 

The publisher suggests Tkinter has been replaced by
wxPython and QtPy is this correct?

 

Also: Is there any point in continuing the use of
Tkinter for python GUI apps when other resources are available?  

 

Could you point me to the correct to post the above
if you are unable to answer?

Thanks

Joseph

 

 






-- 
http://mail.python.org/mailman/listinfo/python-list

TKinter

2005-08-20 Thread SolaFide
I want to create the window and contents in a class, and then use a
separate function to write text to the buttons. Then when it clicks a
button, I want it to call a check() function to see if that was the
right button and then write some new stuff to the buttons. So far it
displays the window all right, but it doesn't write the text I want it
to. I am calling Tk().mainloop() inside the class; is that the problem?

Thanks!

B

-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter

2006-06-02 Thread david brochu jr
Does anyone know how to get the value of the file selected when using tk_getOpenFile in Tkinter?
-- 
http://mail.python.org/mailman/listinfo/python-list

TKinter

2006-06-08 Thread V Sivakumar
Dear Group!,
I am new to Python. I have Eclipse with Python support , is there 
better IDE for free and with good support for GUI development. I need 
to develop a nice looking desktop application. Like we could do in VB, 
C# and Java Swing. Is there  a drag drop support GUI toolkit for 
Python like the above languages do?

Thanks
Siva




-- 
http://mail.python.org/mailman/listinfo/python-list


TKinter

2006-06-08 Thread V Sivakumar
Dear Group!,
I am new to Python. I have Eclipse with Python support , is there 
better IDE for free and with good support for GUI development. I need 
to develop a nice looking desktop application. Like we could do in VB, 
C# and Java Swing. Is there  a drag drop support GUI toolkit for 
Python like the above languages do?

Thanks
Siva




-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter

2006-04-08 Thread Jay
Cold somebody please enlighten me at why code 1 works perfectly and yet
code to will not display the gif file.

code 1
---START-

from Tkinter import *

root = Tk()

MainFrame = Canvas(root)
MainFrame.pack()

BackgroundFile = PhotoImage(file="Background.GIF")
Background = MainFrame.create_image(0, 0, image=BackgroundFile)

root.mainloop()

---END-

code 2
---START-----

from Tkinter import *

class App:
def __init__(self, root):
self.MainFrame = Canvas(root)
self.MainFrame.pack(fill=BOTH, expand=1)

BackgroundFile = PhotoImage(file="Background.GIF")
Tank1 = self.MainFrame.create_image(0, 0, image=BackgroundFile)

root = Tk()
app = App(root)
root.mainloop()

---END-
Thanks 

Jay

-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter

2006-04-16 Thread Jay
I wold like to be able to generate buttons from a list in a file.
How would I go about making each button have a different command,
Lets say make the button print its label instead of print "."

The problem I have is I don't know what the list is going to be until
it is opened or how big so I carnet make a def for each.

And I don't know how to do it with a loop

Thanks

--Code---

from Tkinter import *

class App:
def __init__(self, root):

self.DisplayAreaListsFrame = Frame(root)
self.DisplayAreaListsFrame.pack()

Lists = ["A1","B2","C3","D4"]

for i in Lists:
self.DisplayAreaListButton = Button(
self.DisplayAreaListsFrame,
text=i,
command=self.ListButtonCommand)
self.DisplayAreaListButton.pack(side=LEFT,padx=10)

def ListButtonCommand(self):
print "."

root = Tk()
app = App(root)
root.mainloop()

-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter

2006-11-30 Thread Boneh
The module is not found on the system, althouhg I can use python2.4. i
am using fedoralinux5

Thanks

-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter Puzzler

2005-01-07 Thread Tim Daneliuk
I am trying to initialize a menu in the following manner:
for entry in [("Up", KeyUpDir), ("Back", KeyBackDir), ("Home", KeyHomeDir), ("Startdir", KeyStartDir), ("Root", 
KeyRootDir)]:

func = entry[1]
UI.ShortBtn.menu.add_command(label=entry[0], command=lambda: func(None))
However, at runtime, each of the menu options binds to the *last* function
named in the list (KeyStartDir).
Explicitly loading each entry on its own line works fine:
UIcommand=lambda:KeyWHATEVERDir(None)
Any ideas why the first form does not fly?
TIA,

Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
--
http://mail.python.org/mailman/listinfo/python-list


[Tkinter] problem

2005-01-29 Thread Club-B42
when i start opt_newlogin.py directly it works fine(outputs '1 1 1 1'),  
but if i start it from options.py there is an error(outputs '').


opt_newlogin.py

from config import *
from Tkinter import *
from opt_newlogin import newlogin
def OptionsWindow():
"""
"""
root = Tk()
root.title(msg_OptionsWindowTitle)
b1 = Button(root, text = msgForgotPassword, width = 40).grid(padx = 5,  
pady = 5, column = 0, row = 0)
b2 = Button(root, text = msgNewLogin, command = newlogin, width =  
40).grid(padx = 5, pady = 5, column = 0, row = 1)

root.mainloop()
if __name__ == '__main__':
OptionsWindow()
====

====
options.py

from config import *
from Tkinter import *
import tkMessageBox, os.path
def create_new_account(login, password, secretq, secreta):
print login, password, secretq, secreta
if os.path.exists(os.path.join(data_path, login)):
tkMessageBox.showerror(title = msgError, message =  
msgPasswordLoginExists)
elif login == '':
pass
else:
os.mkdir(os.path.join(data_path, login))
fd = file(os.path.join(data_path, login, data_info_file_name),  
'wb')
fd.write(password + os.linesep)
fd.write(secretq + os.linesep)
fd.write(secreta + os.linesep)
fd.close()
tkMessageBox.showinfo(title = msgInfoAccountCreated, message =  
msgInfoAccountCreated2)

def newlogin():
"""
"""
root = Tk()
root.title(msg_NewLoginWindowTitle)
l1 = Label(root, text = msgLogin).grid(padx = 5, pady = 5, column = 0,  
row = 0, sticky = E)
l2 = Label(root, text = msgPassword).grid(padx = 5, pady = 5, column =  
0, row = 1, sticky = E)
l3 = Label(root, text = msgConfirmPassword).grid(padx = 5, pady = 5,  
column = 0, row = 2, sticky = E)
l4 = Message(root, text = msgKeyQuestion, width = 250).grid(padx = 5,  
pady = 5, column = 0, row = 3, sticky = E)
l5 = Label(root, text = msgKeyQuestionAnswer).grid(padx = 5, pady = 5,  
column = 0, row = 4, sticky = E)

v1 = StringVar()
v2 = StringVar()
v3 = StringVar()
v4 = StringVar()
v5 = StringVar()
e1 = Entry(root, width = 50, textvariable = v1)
e1.grid(padx = 5, pady = 5, column = 1, row = 0)
e1.focus_force()
e2 = Entry(root, width = 50, textvariable = v2, show = '*')
e2.grid(padx = 5, pady = 5, column = 1, row = 1)
e3 = Entry(root, width = 50, textvariable = v3, show = '*')
e3.grid(padx = 5, pady = 5, column = 1, row = 2)
e4 = Entry(root, width = 50, textvariable = v4)
e4.grid(padx = 5, pady = 5, column = 1, row = 3)
e5 = Entry(root, width = 50, textvariable = v5, show = '*')
e5.grid(padx = 5, pady = 5, column = 1, row = 4)
def b1_cmd():
if v2.get() <> v3.get():
tkMessageBox.showerror(title = msgError, message =  
msgPasswordConfirmError)
print v1.get(), v2.get(), v4.get(), v5.get()
create_new_account(v1.get(), v2.get(), v4.get(), v5.get())

b1 = Button(root, text = msgCreateNewLoginButton, command =  
b1_cmd).grid(padx = 5, pady = 5, column = 0, row = 5)
b2 = Button(root, text = msgCancelButton, command =  
root.destroy).grid(padx = 5, pady = 5, column = 1, row = 5)

root.mainloop()
if __name__ == '__main__':
newlogin()


config.py

# codepage = cp1251
#
#
#
def u(s):
return unicode(s, 'cp1251')
msgMainWindowTitle  = u('Менеджер сохранялок клуба B 4\\2')
msgLogin= u('Логин')
msgPassword = u('Пароль')
msgGameNumber   = u('Номер игры')
msgSaveButton   = u('  Сохранить  ')
msgLoadButton   = u('  Загрузить  ')
msgOptionsButton= u('  Дополнительно  ')
msg_OptionsWindowTitle  = u('Дополнительно')
msgForgotPassword   = u('  Забыл пароль  ')
msgNewLogin = u('  Новый логин  ')
msg_NewLoginWindowTitle = u('Создание нового логина')
msgConfirmPassword  = u('Еще раз пароль')
msgKeyQuestion  = u('Секретный вопрос - ответ на  
который знаете только вы - на случай, если вы забудете пароль')
msgKeyQuestionAnswer= u('Ответ на секретный вопрос')
msgCreateNewLoginButton = u('  Создать  ')
msgCancelButton = u('  Отмена  ')
msgError= u('Ошибка')
msgPasswordConfirmError = u('Пароли не совпадают.')
msgPasswordLoginExists  = u('Такой логин уже существует.')
msgInfoAccountCreated   = u('Л

broke tkinter

2005-02-08 Thread Philippe C. Martin
Hi,

I decided to clean my system and rebuild python from scratch.

I downloaded tk8.4.9, tcl8.4.9 and Python2-4.tar.bz2.

I installed tcl then tk using './configure --prefix=/usr'

tkcvs is now working OK


trying to compile python (configure = './configure --prefix=/usr', I get
this:


In file included
from /home/philippe/downloaded/Python-2.4/Modules/_tkinter.c:67:
/usr/include/tk.h:337: error: syntax error before "CONST84"
In file included from /usr/include/tk.h:1576,

from /home/philippe/downloaded/Python-2.4/Modules/_tkinter.c:67:

Any clue!

Regards,

Philippe


-- 
***
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
***

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: TKinter

2005-02-27 Thread Peter Hansen
anthonyberet wrote:
So, is it pronounced 'Tee-Kinter', or 'Tee-Kay-Inter'?
I don't want to appear as a dork down the pub.
Both, in my experience.
And then there's wxPython, which is pronounced variously
as "wiks-python", "double-you-eks-python", or even in some
strange way that I'll leave it to Mike Fletcher to describe
since it embarrasses me even to mention it. ;-)
-Peter
--
http://mail.python.org/mailman/listinfo/python-list


Re: TKinter

2005-02-27 Thread James Stroud
I thought the T was silent.

On Sunday 27 February 2005 08:34 am, anthonyberet wrote:
> So, is it pronounced 'Tee-Kinter', or 'Tee-Kay-Inter'?
> I don't want to appear as a dork down the pub.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: TKinter

2005-02-28 Thread Curt
On 2005-02-27, James Stroud <[EMAIL PROTECTED]> wrote:

> I thought the T was silent.

Kay-Inner, nasally?

>> So, is it pronounced 'Tee-Kinter', or 'Tee-Kay-Inter'?
>> I don't want to appear as a dork down the pub.

-- 
There is no intelligence without being.  I believe the inverse
to be equally true.  It appears then that I have somehow 
misinterpreted your status.
- G.C. Manstalz, in conversation
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: TKinter

2005-02-28 Thread Ruben Baumann
"anthonyberet" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> So, is it pronounced 'Tee-Kinter', or 'Tee-Kay-Inter'?
> I don't want to appear as a dork down the pub.

How about Tic-Inter.  :-)



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: TKinter

2005-02-28 Thread Steve Holden
anthonyberet wrote:
So, is it pronounced 'Tee-Kinter', or 'Tee-Kay-Inter'?
I don't want to appear as a dork down the pub.
If anyone down your pub knows enough about Python to understand what 
TKinter is I very much doubt they'll be rude enough to call you a dork 
for displaying your ignorance.

that's-my-kind-of-pub-ly y'rs  - steve
--
Meet the Python developers and your c.l.py favorites March 23-25
Come to PyCon DC 2005  http://www.pycon.org/
Steve Holden   http://www.holdenweb.com/
--
http://mail.python.org/mailman/listinfo/python-list


Re: TKinter

2005-02-28 Thread anthonyberet
Steve Holden wrote:
anthonyberet wrote:
So, is it pronounced 'Tee-Kinter', or 'Tee-Kay-Inter'?
I don't want to appear as a dork down the pub.

If anyone down your pub knows enough about Python to understand what 
TKinter is I very much doubt they'll be rude enough to call you a dork 
for displaying your ignorance.

that's-my-kind-of-pub-ly y'rs  - steve
I have never recovered from the time I said 'Lye-Nux' and 'Ess-Kyoo-Ell' 
in the same evening ;|)
--
http://mail.python.org/mailman/listinfo/python-list


Re: TKinter

2005-03-01 Thread Steve Holden
anthonyberet wrote:
Steve Holden wrote:
anthonyberet wrote:
So, is it pronounced 'Tee-Kinter', or 'Tee-Kay-Inter'?
I don't want to appear as a dork down the pub.

If anyone down your pub knows enough about Python to understand what 
TKinter is I very much doubt they'll be rude enough to call you a dork 
for displaying your ignorance.

that's-my-kind-of-pub-ly y'rs  - steve

I have never recovered from the time I said 'Lye-Nux' and 'Ess-Kyoo-Ell' 
in the same evening ;|)
in-which-case-you-need-a-new-pub-ly y'rs  - steve
--
http://mail.python.org/mailman/listinfo/python-list


tkinter destroy()

2005-03-29 Thread max(01)*
hi people.
when i create a widget, such as a toplevel window, and then i destroy 
it, how can i test that it has been destroyed? the problem is that even 
after it has been destroyed, the instance still exists and has a tkinter 
name, so testing for None is not feasible:

>>> import Tkinter
>>> fin = None
>>> fin1 = Tkinter.Toplevel()
>>> fin1.destroy()
>>> print fin1
.1075951116
any help?
bye
macs
--
http://mail.python.org/mailman/listinfo/python-list


Tkinter & Tkconstants

2005-04-18 Thread codecraig
Hi,
  I was reading through the Tkinter tutorial at
http://www.pythonware.com/library/tkinter/introduction/index.htm ...and
it mentions that by doing,

from Tkinter import *

you have access to the constants in Tkconstants, since Tkinter imports
it automatically.

However, in the shell if I do..

from Tkinter import *

print Tkinter.HORIZONTAL

I get an error..NameError: Tkinter is not defined

any ideas?  However, if I do,

import Tkconstants
print Tkconstants.HORIZTONAL

I get what i expect.  but according to the tutorial i should only need
Tkinter.

Thanks.

-- 
http://mail.python.org/mailman/listinfo/python-list


tkinter puzzler

2005-05-12 Thread Paul Rubin
I have a gui with a bunch of buttons, labels, the usual stuff.  It
uses the grid manager:

   gui = Frame()
   gui.grid()
   gui.Label().grid()  # put some widgets into the gui
   ...# more widgets

Now at the the very bottom of the gui, I want to add two more buttons,
let's say "stop" and "go".  I want "stop" to appear in the gui's lower
left corner and "go" to appear in the gui's lower right corner.
Suppose that up to now, row 16 is the last row in the gui.  Then this
works:

Button(gui, text="stop").grid(sticky=W)   # starts row 17
Button(gui, text="go").grid(row=17, column=1, sticky=E)

But I don't really want that hardwired row number and I don't want to
keep counting rows and adjusting stuff if I stick new rows in the gui.
So I try the obvious, make one Frame widget containing both new buttons:
stopgo = Frame(gui)
Button(stopgo, "stop").grid(sticky=W)
Button(stopgo, "go").grid(sticky=E)

and try to stretch it across the bottom row of the gui:

stopgo.grid(sticky=E+W)

However, the buttons keep coming out centered in the gui's bottom row
pretty much no matter what I do (I've tried all sorts of combinations).

Am I missing something?  I'm not a tkinter whiz and this stuff is
pretty confusing.  I did come up with an ugly workaround that I'll
spare you the agony of seeing, but there should be a natural way to do
this.

Thanks for any advice.
-- 
http://mail.python.org/mailman/listinfo/python-list


running tkinter

2005-05-31 Thread Jim Anderson

I have just installed Fedora Core 3 on my pc. Python runs
fine, but when I try to run tkinter the tkinter library is
not found. I tried installing python 2.4.1 and could not get
tkinter to run there either.

When I look through the build directories for 2.4.1, I find
a lib-tk, but I do not find anything for tcl. In past releases,
my recollection is that tcl/tk were part of the release and
that if TCL_LIBRARY and TK_LIBRARY environment variables were
set right, then tkinter would work.

Are tcl/tk still supposed to be an intergrated part of the
python release?

Do I have to download, configure, make, install tcl and tk
packages to get tkinter running?

Thanks for any suggestions in advance.

Jim Anderson
-- 
http://mail.python.org/mailman/listinfo/python-list


tkinter drawing

2005-10-15 Thread Ron Adam

I want to be able to easily create reusable shapes in Tkinter and be 
able to use them in mid level dialogs.  So after some experimenting I've 
managed to get something to work.

The following does pretty much what I need, but I think it can be 
improved on. So could anyone take a look and let me know what you think?

Some of the things I want to add, but aren't exactly sure how at this time:
Nested groups
Use tags to be able to change sub items later
Have items get attribues from the group if it doesn't have them

Hope this isn't too long.

Cheers, Ron



"""
Tkinter Color Vector Objects

Just the bare minimum to create re-sizable
and re-usable color icons in tkinter.
"""

import Tkinter as Tk
import math

def getregpoly(sides):
 """ Get points for a unit regular-polygon with n sides. """
 points = []
 ang = 2*math.pi / sides
 for i in range(sides):
 deg = (i+.5)*ang
 points.append(math.sin(deg)/2.0+.5)
 points.append(math.cos(deg)/2.0+.5)
 return points

def scale(points, scale):
 return [x*scale for x in points]

def move(points, x, y):
 xy = [x,y]*(len(points)//2)
 return [xy+coord for xy, coord in zip(xy,points)]

def translate(obj, x, y, zoom):
 p = scale(obj.points, obj.size)
 p = move(p, obj.x, obj.y)
 p = scale(p, zoom)
 return move(p, x, y)

def draw(obj, c, x=0 ,y=0, zoom=1):
 p = translate(obj, x, y, zoom)
 if obj.obj=='line':
 c.create_line( p, fill=obj.fill, width=obj.width,
arrow=obj.arrow )
 elif obj.obj=='rectangle':
 c.create_line( p, fill=obj.fill, outline=obj.outline,
width=obj.width)
 elif obj.obj=='polygon':
 c.create_polygon( p, fill=obj.fill, outline=obj.outline,
   width=obj.width, smooth=obj.smooth )
 elif obj.obj=='text':
 size = int(obj.size*zoom)
 font = (obj.font,size,obj.style)
 c.create_text(p, text=obj.text, font=font, fill=obj.fill)
 elif obj.obj=='oval':
 c.create_oval( p, fill=obj.fill, outline=obj.outline,
width=obj.width )
 elif obj.obj=='arc':
 c.create_arc( p, start=obj.start, extent=obj.extent,
   style=obj.style, fill=obj.fill,
   outline=obj.outline, width=obj.width )

class Shape(object):
 size = 1
 x = y = 0
 def __init__(self, **kwds):
 self.__dict__.update(kwds)
 def __call__(self, *args, **kwds):
 for key in self.__dict__:
 if key not in kwds:
 kwds[key] = self.__dict__[key]
 return self.__class__(*args, **kwds)
 def draw(self, c, x=0, y=0, scale=1.0):
 draw(self, c, x, y, scale)

class Group(list):
 obj = 'group'
 def __init__(self, *args, **kwds):
 self[:] = args
 self.__dict__.update(kwds)
 def __call__(self, *args, **kwds):
 args = self[:]+list(args)
 for key in self.__dict__:
 if key not in kwds:
 # make copies
 kwds[key] = self.__dict__[key]()
 return self.__class__(*args, **kwds)
 def draw(self, c, x=0, y=0, scale=1.0):
 for item in self:
 item.draw(c, x, y, scale)
 for key in self.__dict__:
 self.__dict__[key].draw(c, x, y, scale)

# base shapes.
text = Shape( obj='text', text='', fill='black', width=0,
   font='', style='', points=[0,0] )
line = Shape( obj='line', arrow='none', fill='black',
   smooth='false', width=1, points=[0,0,1,0])
rectangle = Shape( obj='rectangle', fill='', outline='black',
width=1, points=[0,0,1,.5])
polygon = Shape( obj='polygon', fill='grey', outline='',
  width=0, points=[0,0], smooth='false' )
oval = Shape( obj='oval', fill='grey', outline='',
   width=0, points=[0,0,1,.75] )
arc = Shape( obj='arc', fill='grey', outline='', width=0,
  style='arc', start='0', extent='90',
  points=[0,0,1,1])

# shape variations
chord = arc(style='chord')
pie = arc(style='pieslice')
circle = oval(points=[0,0,1,1])
square = rectangle(points=[0,0,1,1])
triangle = polygon( points=getregpoly(3))
octagon = polygon( points=getregpoly(8))

# CAUTION ICON
caution = Group(
 triangle(x=6, y=5, size=75),
 triangle(size=75, fill='yellow'),
 txt = text( text='!',
 x=38, y=32, size=30,
 font='times', style='bold') )

# ERROR ICON
circlepart 

Tkinter problem

2005-10-31 Thread dale cooper
Hi everybody!
I've recently installed python2.4.2 on Fedora 4 (from downloaded
sources), but it appeared, that I can't use Tkinter module:

>>> import Tkinter
Traceback (most recent call last):
  File "", line 1, in ?
  File "/usr/local/lib/python2.4/lib-tk/Tkinter.py", line 38, in ?
import _tkinter # If this fails your Python may not be configured
for Tk
ImportError: libBLT24.so: cannot open shared object file: No such file
or directory

I tried the solution given in README file for RH9 (./configure
--enable-unicode=ucs4) despite they wrote the newer wersion didn't need
this hack. This is what I had after make instruction:

INFO: Can't locate Tcl/Tk libs and/or headers
*** WARNING: renaming "array" since importing it failed:
build/lib.linux-i686-2.4/array.so: undefined symbol:
PyUnicodeUCS2_FromUnicode
*** WARNING: renaming "_testcapi" since importing it failed:
build/lib.linux-i686-2.4/_testcapi.so: undefined symbol:
PyUnicodeUCS2_Decode
*** WARNING: renaming "unicodedata" since importing it failed:
build/lib.linux-i686-2.4/unicodedata.so: undefined symbol:
PyUnicodeUCS2_FromUnicode
*** WARNING: renaming "_locale" since importing it failed:
build/lib.linux-i686-2.4/_locale.so: undefined symbol:
PyUnicodeUCS2_AsWideChar
*** WARNING: renaming "cPickle" since importing it failed:
build/lib.linux-i686-2.4/cPickle.so: undefined symbol:
PyUnicodeUCS2_AsUTF8String
*** WARNING: renaming "pyexpat" since importing it failed:
build/lib.linux-i686-2.4/pyexpat.so: undefined symbol:
PyUnicodeUCS2_DecodeUTF8
*** WARNING: renaming "_multibytecodec" since importing it failed:
build/lib.linux-i686-2.4/_multibytecodec.so: undefined symbol:
PyUnicodeUCS2_FromUnicode
running build_scripts

It seems that --enable-unicode=ucs4 wasn't the right way. I tried
another hack: ./configure --enable-shared, but it still couldn't locate
Tcl/Tk libs and/or headers. Then I installed RPMs:

[EMAIL PROTECTED] Python-2.4.2]# rpm -q tk
tk-8.4.9-3
[EMAIL PROTECTED] Python-2.4.2]# rpm -q tcl
tcl-8.4.9-3
[EMAIL PROTECTED] Python-2.4.2]# rpm -q tkinter
tkinter-2.4.1-2

and tried to do the hacks above, but it still could'nt find these libs.
What can I do?

-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter- checkbutton

2005-11-04 Thread Tuvas
I want to have a checkbutton that when it is pushed will do a function
depending on if it was pushed before or not. Ei:

b=checkbutton(command=check)
b.grid(row=0,column=0)

def check():
if (b.value==0):
   do_stuff_here()
elif(b.value==1)
   do_other_stuff_here()


However, I keep running into problems with reading the data. How do I
make this work? Thanks!

-- 
http://mail.python.org/mailman/listinfo/python-list


PIL-> Tkinter

2005-11-09 Thread Tuvas
Is there a way to put an image loaded from PIL into a TKinter GUI?
Without converting the image to a .bmp, and using a canvas? If that's
the only way it'll work, I'll take it, but... It would be nice
otherwise...

-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter Images

2005-11-23 Thread Tuvas
I've been trying to use a canvas to display different pictures on a
Tkinter interface. However, it doesn't seem to update the information.
Ei, I have something like this.

canvas=Canvas(master,blah...)
canvas.pack()

def change_pic(path):
  global pic
  image=Image()   #I'm using PIL to use the images, but I
don't think it's depended... This code's not the important one...
  canvas.create_image(1,1,image=image, anchor=NW)

change_pic("test1.jpg")

I have written a simple scipt that just displays an image, without any
problems. However, when I try to change the image dynamically, it
doesn't work. If needed I can put the real code, however, it's a bit
complicated to do so, this computer doesn't support copying from the
terminal to the web browser. Thanks for the help!

-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter menu

2005-12-01 Thread [EMAIL PROTECTED]
Hi,

I'm writing a small GUI program in Python/Tkinter (my first Python
program).  I want to make a menu which lists the names of a number of
text files that my program uses/generates.  When I select one of the
files from the menu, I would like a new window to open up a scroll box
containing the file.  I was able to get it to work by hard a separate
function for each file name in the addmenuitem for each file, but as the
number of files grows, that gets to be tedious.  So I'm trying to write
the menu bar as a loop, but I don't know how to get the file name passed
to the function if the I use only one function call.  Below is what I'm
trying to do, but it doesn't work since the file name or parent window
is passed to the function.  Can anyone give me some tips on a good way
to accomplish this without hard-coding a different function for each
menu item?  Thanks.

John

class App:
  def __init__(self,parent):

self.inputfiles = ('input.txt', 'EdgeSlotArray.txt', 'RectWave.txt',
  'RectWaveWithBaffles.txt', 'Suppressor.txt', 'gaopt.txt')
self.outputfiles = ('s11.dat', 's21.dat')
self.allfiles = self.inputfiles+self.outputfiles

self.master = parent
top = Frame(parent)
top.pack(side='top')

firstrow = Frame(top)
firstrow.pack(side='top')

self.showfilemenu_bar = Pmw.MenuBar(firstrow,
hull_borderwidth=1)
self.showfilemenu_bar.pack(side='left')
self.showfilemenu_bar.addmenu('Show Files',None,tearoff=True)
for file in self.allfiles:
  self.showfilemenu_bar.addmenuitem('Show Files',
'command',label=file, command=self.ShowFile)

  def ShowFile(self,fname,parent):
filewindow=Toplevel(parent)
file = open(fname,'r')
filestr = file.read()
file.close()
filetext=Pmw.ScrolledText(filewindow,
  borderframe=5, vscrollmode='dynamic',
  labelpos='n',label_text=fname,
  text_font=Pmw.logicalfont('Courier'),
  text_width=70,text_height=25,text_wrap='none')
filetext.pack(expand=True,fill='both')
filetext.insert('end',filestr)

Button(filewindow,text='Close',
  command=filewindow.destroy).pack(pady=10)
-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter interactive

2005-12-17 Thread cm012b5105
Hello i am fairly new to python,
I have written an interactive programme a small example of it is here.
s = raw_input ("Do you have any children? ")
if s== 'yes':
   print "Thats great"
elif s=='no':
   print "Well my boss has 2"


Now i have also been looking at Tkinter if we take the basic "hello, world" 
programme which is like this.

# File: hello1.py

from Tkinter import *

root = Tk()

w = Label(root, text="Hello,!")
w.pack()

root.mainloop()

What i want is to incorporate this in to my programme so when i start my 
programme a little box appears saying hello then my interactive programme 
runs within the box
This it what it looks like

from Tkinter import *

root = Tk()

w = Label(root, text="Hello,!")
w.pack()
s = raw_input ("Do you have any children? ")
if s== 'yes':
   print "Thats great"
elif s=='no':
   print "Well my boss has 2"

The result of that is i just get another box open and start to run my 
interactive programme as though it ignores the Tk box which says hello hope 
this makes sense any advise on this please.
thanks nige
-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter question

2005-06-14 Thread Nicholas . Vaidyanathan
Title: Tkinter question






I'm sure there must be a way to do this, but I can't figure it out for the life of me… I'm writing a program where I would like to use a button's text field as part of an if statement. I set up my button like this:

 i = [ "7", "8","9", "/", "4", "5", "6", "*", "1", "2", "3", "-", "0", ".", "=", "+"]

 t = 0   #iterator through the sequence


for x in range(4):

    for y in range(4):

    self.buttonx = Button(self, text = "%s" %i[t] , width=10, command = self.pressed)

    self.buttonx.grid( row=x+1, column = y, sticky = W+E+S)

    t+=1


What I would like to do is is check which buttons' text values are digits, and if the text is, I would like to append the number to a label. But:

if(self.buttonx.title.isdigit):


Doesn't work. How do I access the button's text field?


Thanks!



"MMS " made the following annotations.
--
--- NOTICE ---
This message is for the designated recipient only and may contain confidential, privileged or proprietary information.  If you have received it in error, please notify the sender immediately and delete the original and any copy or printout.  Unintended recipients are prohibited from making any other use of this e-mail.  Although we have taken reasonable precautions to ensure no viruses are present in this e-mail, we accept no liability for any loss or damage arising from the use of this e-mail or attachments, or for any delay or errors or omissions in the contents which result from e-mail transmission.

==

-- 
http://mail.python.org/mailman/listinfo/python-list

Tkinter Question

2005-06-15 Thread Nicholas . Vaidyanathan
Title: Tkinter Question






Thanks for all the help guys… I'm a bit confused as to the inner workings of the Tkinter system (I'm both a Python and a GUI n00b). I was hoping that by slapping the x on button python was doing some cool dynamic variable creation (i.e. creating 9 variables with 1 loop using the x as a variable to modify the identifier), but I suppose you can't do that in Python (or can you?) I'm a little confused as to why self.button.text doesn't work but self.button["text"] does, can someone explain this? 

Thanks!

-Nick 



"MMS " made the following annotations.
--
--- NOTICE ---
This message is for the designated recipient only and may contain confidential, privileged or proprietary information.  If you have received it in error, please notify the sender immediately and delete the original and any copy or printout.  Unintended recipients are prohibited from making any other use of this e-mail.  Although we have taken reasonable precautions to ensure no viruses are present in this e-mail, we accept no liability for any loss or damage arising from the use of this e-mail or attachments, or for any delay or errors or omissions in the contents which result from e-mail transmission.

==

-- 
http://mail.python.org/mailman/listinfo/python-list

tkinter radiobutton

2005-06-25 Thread William Gill
I am placing radiobuttons in a 4 X 4 matrix (using loops) and keep 
references to them in a 2 dimensional list ( rBtns[r][c] ).  It works 
fine, and I can even make it so only one button per column can be 
selected, by assigning each column to an intVar.  In many languages a 
radiobutton has a property that can be directly read to see if it is 
selected on unselected.  Tkinter radiobuttons don't seem to have any 
such property.  Is there any way to look (via the script not the screen) 
to determine if it is selected?, or can this only be achieved via 
control variables?

Bill
-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter Checkboxes

2006-02-20 Thread D
Ok, I'm sure this is something extremely simple that I'm missing,
but..how do I set a variable in a Tkinter Checkbox?  i.e. I have a
variable "test" - if the checkbox is selected, I want to set test=1,
otherwise 0.  Thanks!

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: TKinter

2005-08-21 Thread [EMAIL PROTECTED]

It's pretty hard to know what the problem is with the vague description
you've provided.  Why not post your problem code or, if there's a lot
of it, create a small sample that has the problematic behaviour.
Better yet, post your message to [EMAIL PROTECTED]

cheers
S

-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter question

2006-05-31 Thread david brochu jr
I am trying to create a GUI that will display a new window with information about my program when the user clicks on the info button (a green "i" bitmap). So far all I can get my program to do is show the new window (using Toplevel() ) when the program loads, not when the user presses the information bitmap. I think it has something to do with my command for the information button. Anyone have any ideas or have a GOOD resource that they could point me to?

 
Thanks
 

from Tkinter import *
class Application(Frame):  """ A GUI application with three buttons. """    def __init__(self, master):    """ Initialize the Frame. """    Frame.__init__(self,master)
    self.grid()    self.create_widgets()     def update_text(self):    message = self.toolbar.get()    self.results.delete(0.0, END)    self.results.insert(0.0, message)      def create_widgets(self):
    # create variable for single toolbar selection    self.toolbar = StringVar()        """Create button, text and entry widgets. """    #create welcome text    welcome = Label(self)
    welcome["text"] = "You are now about to run Automation Testing.\n"\    "Please check the toolbar to be tested and then select\n"\    "the test you would like to perform."
        welcome.grid(row = 0, column = 0, columnspan = 3, sticky = W)        #create Upr Radio    Radiobutton(self, text = "Upr", variable = self.toolbar,    value = "upr", command = 
self.update_text).grid(row = 1, column = 0, sticky = W)        #create Com Radio    Radiobutton(self, text = "Com", variable = self.toolbar,    value = "com", command = self.update_text
).grid(row = 1, column = 1, sticky = W)        #create CI Radio    Radiobutton(self, text = "CI", variable = self.toolbar,    value = "ci", command = self.update_text).grid(row = 1, column = 2, sticky = W)
        #create text box    self.results = Text(self, width = 40, height = 4, wrap = WORD)    self.results.grid(row = 2, column = 0, columnspan = 3, sticky = W)            #create Performance button
    self.perf_bttn = Button(self)    self.perf_bttn["text"] = "Performance"    self.perf_bttn["command"] = self.perf    self.perf_bttn.grid(row = 3, column = 0, sticky = W) 
    message = self.toolbar.get()        #create PII button    self.pii_bttn = Button(self)    self.pii_bttn["text"] = "PII"    self.pii_bttn.grid(row = 3, column = 1, sticky = W)
        #create info button    self.info_bttn = Button(self)    self.info_bttn["fg"] = "green"    self.info_bttn["bitmap"] = "info"    self.info_bttn.command = self.info
()    self.info_bttn.grid(row = 3, column = 2, sticky = W)        #create exit button    self.exit_bttn = Button(self)    self.exit_bttn["fg"] = "red"    self.exit_bttn["cursor"] = "pirate"
    self.exit_bttn["text"] = "EXIT"    self.exit_bttn["command"] = root.quit    self.exit_bttn.grid(row = 3, column = 3, sticky = W)    def perf(self):    import performance
    performance.perf(self.toolbar.get())
      def info(self):    # create child window     win = Toplevel()                  # mainroot = Tk()root.title("Automation Testing")app = Application(root)
root.mainloop()
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter

2006-06-02 Thread Fredrik Lundh
"david brochu jr" wrote:

> Does anyone know how to get the value of the file selected when using
> tk_getOpenFile in Tkinter?

why not use the tkFileDialog module:

http://www.pythonware.com/library/tkinter/introduction/x1164-data-entry.htm

?

 



-- 
http://mail.python.org/mailman/listinfo/python-list


TKinter problem

2006-03-21 Thread C D Wood
To whom this may concern,
Below is the source code, which

demonstrates a
problem I am having making a GUI for my python project  work.
'table.txt'
is a file that is read from the same folder.

My code writes to a text file 'table.txt', and 'table.txt' is displayed
in
the GUI. The user can generate new data at the click of a button
which re-writes 'table.txt', but I can only add the new table to the
GUI
 window rather than 'update' the existing one.

Any assistance would be much appreciated,

Regards,
Christian Wood.
Part III Aerospace Engineering
University of Southampton, UK.

##########
from Tkinter import *

#Tkinter User Interface
class MoC:
def __init__(self, master):
frame = Frame(master, width=600, height=800, bd=1)
frame.pack()

#Button frame
iframe4 = Frame(frame, bd=2, relief=SUNKEN)
#Using this button below, I want to update the text box in iframe5.
Button(iframe4, text='Display table.txt',
command=self.DisplayUpdate).pack(side=LEFT, padx=5)
Button(iframe4, text='Quit', command=self.quit).pack(side=LEFT,
padx=5)
iframe4.pack(expand=1, fill=X, pady=10, padx=5)

#Text box frame
iframe5 = Frame(frame, bd=2, relief=SUNKEN)
text=Text(iframe5, height=10, width =70)
fd = open('table.txt')  #table.txt must be in the same folder
lines = fd.read()
fd.close()
text.insert(END, lines)
text.pack(side=LEFT, fill=X, padx=5)
sb = Scrollbar(iframe5, orient=VERTICAL, command=text.yview)
sb.pack(side=RIGHT, fill=Y)
text.configure(yscrollcommand=sb.set)
iframe5.pack(expand=1, fill=X, pady=10, padx=5)

#Command definitions
def quit(self):
root.destroy()

def DisplayUpdate(self): #The command definition used to update the
display.
#Could I insert a line here to remove the existing frame/text
box first?  <<<<<=
iframe5 = Frame(root, bd=2, relief=SUNKEN)
text = Text(iframe5, height=10, width =70)
fd = open('table.txt')
lines = fd.read()
fd.close()
text.insert(END, lines)
text.pack(side=LEFT, fill=X, padx=5)
sb = Scrollbar(iframe5, orient=VERTICAL, command=text.yview)
sb.pack(side=RIGHT, fill=Y)
text.configure(yscrollcommand=sb.set)
iframe5.pack(expand=1, fill=X, pady=10, padx=5)

root = Tk()
root.option_add('*font', ('arial', 10))
all = MoC(root)
root.title('2D Method of Characteristics')
root.update
root.mainloop()

-- 
http://mail.python.org/mailman/listinfo/python-list


tkinter+matplotlib

2006-03-27 Thread Giacomo Boffi
i have coded some progs that use the Pmw.Blt.Graph widgets, embedded
in a simple Tkinter GUI

,
| from Tkinter import *
| import Pmw
| ...
| frame=Frame(root)
| ...
| graph=Pmw.Blt.Graph(frame,...)
| graph.line_create(...)
| graph.pack(...)
`

now i'd like to port those progs to an environment where i have no BLT

assuming that i can use matplotlib to draw the line graphs i need, how
do i place the graph widget inside my tkinter GUI?

tia,
gb
-- 
  If you grow tired of the friends you make
   Never ever turn the back on them
Say they were the best of time you ever had
The best of times with the thougthless kind-- John Cale
-- 
http://mail.python.org/mailman/listinfo/python-list


tkinter question

2006-03-27 Thread linuxnooby
Hi

I have a tkinter question. In the following script the window will not
display until the script has finished executing. It appears at the same
time as the output "script finished". How can I make it appear
immediately,  with the output "script finished" appearing 5 seconds
later.

cheers Dave

from Tkinter import *
import time

print "script started"

top = Tk()
F = Frame(top)
F.pack()
Hello = Label(F, text="hello world")
Hello.pack()
   
time.sleep(5)
print "script finished"
   
mainloop()

-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter divider

2006-04-01 Thread Jim Lewis
Anyone know how to create a draggable divider between two Tkinter
windows?

-- 
http://mail.python.org/mailman/listinfo/python-list


tkinter canvas

2006-04-04 Thread fxe

Hi,
  I am using tkinter and I have a canvas that with several rectangles drawn
on it. The rectangles need to have bindings to move and resize them. No
problem here, but I also need to display a grid on the same canvas, for
which I am using create_line. My problem is I do not want the grid lines to
be able to move and resize .

Is this doable or any suggestions on an alternative.Maybe another way to
display my grid on top of the canvas?

Tom

--
View this message in context: 
http://www.nabble.com/tkinter-canvas-t1395807.html#a3753823
Sent from the Python - python-list forum at Nabble.com.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter

2006-04-08 Thread baalbek
Excuse me for being slightly off-topic, but why not using wxPython 
(www.wxpython.org)?

Baalbek
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter

2006-04-08 Thread Robert Hicks
Maybe because Tkinter comes *with* Python? It is sometimes easier to
understand the way things work in Tkinter vs wxPython as well. Though I
will add that Manning has just published "wxPython in Action" so that
should help newbies out as well.

Robert

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter

2006-04-08 Thread Fredrik Lundh
"Jay" <[EMAIL PROTECTED]> wrote:

> Cold somebody please enlighten me at why code 1 works perfectly and yet
> code to will not display the gif file.

> code 2
> ---START-
>
> from Tkinter import *
>
> class App:
> def __init__(self, root):
> self.MainFrame = Canvas(root)
> self.MainFrame.pack(fill=BOTH, expand=1)
>
> BackgroundFile = PhotoImage(file="Background.GIF")
> Tank1 = self.MainFrame.create_image(0, 0, image=BackgroundFile)
>
> root = Tk()
> app = App(root)
> root.mainloop()
>
> ---END-
> Thanks

you need to keep a reference to the photo object on the Python side
of things, to keep it from being garbage collected.

see the note at the bottom of this page:

http://www.effbot.org/tkinterbook/photoimage.htm





-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter

2006-04-09 Thread Jay
Now I just get this error message.

AttributeError: 'int' object has no attribute 'image'

But the picture appears so I am almost their.

---START---

from Tkinter import *

class App:
def __init__(self, root):
self.MainFrame = Canvas(root)
self.MainFrame.pack(fill=BOTH, expand=1)

BackgroundFile = PhotoImage(file="Background.GIF")
Background = self.MainFrame.create_image(0, 0,
image=BackgroundFile)
Background.image = BackgroundFile # keep a reference!


root = Tk()
app = App(root)
root.mainloop()

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter

2006-04-09 Thread Fredrik Lundh
"Jay" wrote:

> Now I just get this error message.
>
> AttributeError: 'int' object has no attribute 'image'
>
> But the picture appears so I am almost their.
>
> ---START---
>
> from Tkinter import *
>
> class App:
> def __init__(self, root):
> self.MainFrame = Canvas(root)
> self.MainFrame.pack(fill=BOTH, expand=1)
>
> BackgroundFile = PhotoImage(file="Background.GIF")
> Background = self.MainFrame.create_image(0, 0,
> image=BackgroundFile)
> Background.image = BackgroundFile # keep a reference!

the example on that page attaches the image to a widget instance,
not a canvas object handle (which is an integer; unlike user-defined
classes, integers don't allow you to attach arbitrary attributes to
them).

if you just want to display a single image, just attach it to self:

BackgroundFile = PhotoImage(file="Background.GIF")
Background = self.MainFrame.create_image(0, 0, image=BackgroundFile)
self.image = BackgroundFile # keep a reference!

if you want to display multiple images on the canvas, use a dictionary
or a list to hold active image references.





-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter

2006-04-09 Thread Jay
Brill, Thanks for the help

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter

2006-04-16 Thread Fredrik Lundh
"Jay" wrote:

> I wold like to be able to generate buttons from a list in a file.
> How would I go about making each button have a different command,
> Lets say make the button print its label instead of print "."
>
> The problem I have is I don't know what the list is going to be until
> it is opened or how big so I carnet make a def for each.

def is an executable statement, and creates a new function object
everytime it's executed.  if you want a new function for each pass
through a loop, just put the def inside the loop:

> from Tkinter import *
>
> class App:
> def __init__(self, root):
>
> self.DisplayAreaListsFrame = Frame(root)
> self.DisplayAreaListsFrame.pack()
>
> Lists = ["A1","B2","C3","D4"]
>
> for i in Lists:

   def callback(text=i):
   print text

> self.DisplayAreaListButton = Button(
> self.DisplayAreaListsFrame,
> text=i,
> command=callback)
> self.DisplayAreaListButton.pack(side=LEFT,padx=10)
>
> root = Tk()
> app = App(root)
> root.mainloop()

the only think that's a little bit tricky is scoping: you can access all
variables from the __init__ method's scope from inside the callbacks,
but the callbacks will be called after the loop is finished, so the "i"
variable will be set to the *last* list item for all callbacks.

to work around this, you have to explicitly pass the *value* of "i" to
to the callback; the "text=i" part in the above example uses Python's
default argument handling to do exactly that.





-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter

2006-04-16 Thread Jay
I still dont quite get it, is their sum kind of way you can [def Newdef
+ i()] for example so that the def is different from the string, all
the buttons now have numbers on

If I am not mistaken Fredrik Lundh rote the tutorial Learning to
program (Python) www.freenetpages.co.uk/hp/alan.gauld/   and
www.effbot.org

If this is the same person then thank you for everything I no about
python it seams what ever I try and learn about Python it is always you
who helps or has wrote docs to help Newbie's and well everyone
really.

---code---
 from Tkinter import *

class App:
def __init__(self, root):

self.DisplayAreaListsFrame = Frame(root)
self.DisplayAreaListsFrame.pack()

Lists = ["A1","B2","C3","D4"]
for i in Lists:
def i():
print i
self.DisplayAreaListButton = Button(
self.DisplayAreaListsFrame,
text=i,
command=i)
self.DisplayAreaListButton.pack(side=LEFT,padx=10)



root = Tk()
app = App(root)
root.mainloop()

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter

2006-04-17 Thread Ravi Teja
Documentation isn't his only contribution, BTW. He wrote a whole bunch
of highly useful modules for Python as well.
http://effbot.org/downloads/

-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter & systray

2006-10-09 Thread billie
Hi all. I'd like to develop a GUI-based application the most portable
as possible, able to run in systray.
I think that, for portability reasons, Tkinter could be the best
choice, so I tried to google a little bit about it.
According to this :
http://mail.python.org/pipermail/python-list/2002-September/123257.html
...it seems that it's impossible (or better, it WAS impossible in
September 2002) handling this case by using Tkinter.
Four years later is there a way to make this happen?

Thanks in advance.

-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter question

2006-10-23 Thread Sorin Schwimmer
Hi All,Is it possible to have a widget id while it is created?Something like this:Button(root, text='...', command= lambda v=: fn(v)).grid()and then the function:def fn(v):  v['bg']='BLUE' # or maybe nametowidget(v)['bg']='BLUE'Thanks,Sorin-- 
http://mail.python.org/mailman/listinfo/python-list

Tkinter question

2006-10-24 Thread Sorin Schwimmer
Thanks for everybody's advice, on both forums (tkinter-discuss & python-list).I end up using Fredrik's Lundh solution, since, in my project, multiple buttons are using the same callback, and their creation is controlled by the interaction with the user.Thanks again,Sorin-- 
http://mail.python.org/mailman/listinfo/python-list

tkinter popup

2007-03-27 Thread Gigs_
Hi all

I cant figure out how to disable resizing of my popup window?
How to put this popup window to show in the middle of my text editor?
It is writen with Toplevel.


thx
-- 
http://mail.python.org/mailman/listinfo/python-list


tkinter MVC

2007-03-27 Thread Gigs_
Can someone give me example how to write text editor in tkintter with 
model-view-controler?
What goes to controler and what goes to model?



thanks in advance
-- 
http://mail.python.org/mailman/listinfo/python-list


tkinter canvas

2007-04-05 Thread gigs
I have made drawing area and few butons.
How can I make when i click my fill button that later when i click on oval 
oval gets filled with chousen color? 

-- 
http://mail.python.org/mailman/listinfo/python-list


tkinter canvas

2007-04-18 Thread Gigs_
how to write text on canvas. i know that i need to use canvas.create_text, but 
how to write text than when i create_text?
or how to access object ID in canvas and change some options?


thanks in advance!
-- 
http://mail.python.org/mailman/listinfo/python-list


tkinter listbox

2007-04-25 Thread Gigs_
Hi!

Im working on paint program with tkinter canvas.
I have two listbox and when i click on first listbox second become deselected.
I need to take one thing from first listbox and one thing from second at the 
same time.

How to do that?


thx, apologies for bad english
-- 
http://mail.python.org/mailman/listinfo/python-list


tkinter undo

2007-04-28 Thread Gigs_
Hi


I dont have idea how to write tkinter undo/redo function form my text editor 
and 
my paint program.
Could someone help? I'm not asking for code, just for some guidelines to get me 
in the right way.


thanks
-- 
http://mail.python.org/mailman/listinfo/python-list


tkinter listboxes

2007-05-03 Thread rahulnag22
I will give a simplified example of the problem at hand --

I have a case in which I have two listboxes - listbox1 and listbox2,
if I click on an item in listbox1 the item gets highlighted as
expected. Now if I click on an item in listbox2 the selected item in
listbox1 loses its highlight. My question is how do I keep the
listbox1 item from losing its highlight if I select an item in
listbox2 or to that matter any other widget.

Thanks
Rahul

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter

2006-11-30 Thread Boneh

Boneh wrote:
> The module is not found on the system, althouhg I can use python2.4. i
> am using fedoralinux5
> 
> Thanks



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter

2006-11-30 Thread Fredrik Lundh
Boneh wrote:
>> The module is not found on the system, althouhg I can use python2.4. i
>> am using fedoralinux5
> 
> 

I see lots of question marks, but I don't see a question.  are you 
asking why a module you haven't installed isn't installed?  have you 
tried installing it?



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter

2006-11-30 Thread Boneh

Fredrik Lundh wrote:
> Boneh wrote:
> >> The module is not found on the system, althouhg I can use python2.4. i
> >> am using fedoralinux5
> >
> > 
>
> I see lots of question marks, but I don't see a question.  are you
> asking why a module you haven't installed isn't installed?  have you
> tried installing it?
> 
> 
Thanks, I installed tkinter and it works again fine. True! Heh

-- 
http://mail.python.org/mailman/listinfo/python-list


tkinter prob

2006-08-20 Thread JyotiC
hi,
i am making a GUI using Tkinter,
I have a button and a checkbutton.
i want the button to be enable when checkbutton is on and disble when
the checkbutton is off.

thanx

-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter listbox:get

2006-09-07 Thread vedran_dekovic
Hi,
I need help about Tkinter.I want,when somebody click on some item in
listbox,then
in new entry widget must write that item

Regards,
Vedran

-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter listbox:get

2006-09-10 Thread Sorin Schwimmer
lb.curselection() won't return an integer, but a tuple of strings. Also, a StringVar receives a new value with the set() method. So, you'll have to write something like:idx=lb.curselection()StringValue.set(lb.get(int(idx[0])))This will grab the first value from the tuple, convert it in integer, and pass it to lb.get() to extract the line in your Listbox, and set it in your Entry via the StringVar. If
 you allow multiple selections from your Listbox, you may have more than one value in idx, and you'll have to decide how you intend to process them.Check any of these (or both):http://www.pythonware.com/library/tkinter/introduction/index.htmhttp://infohost.nmt.edu/tcc/help/pubs/tkinter/They're both easy to follow, and you'll save more time, than asking one little think at a time, and then waiting for someone to answer.Good luck!Sorin-- 
http://mail.python.org/mailman/listinfo/python-list

Tkinter Scrolling

2007-02-01 Thread D
I'm sure this is a simple question to the Tkinter experts - I have a
very basic Tkinter application that consists of 1 master window and
buttons within that window.  My problem is that, I need to be able to
scroll (up and down) when I get to the point that the buttons go off
the screen.  What's the easiest way to do this?  Thanks in advance.

-- 
http://mail.python.org/mailman/listinfo/python-list


ps tkinter

2007-02-07 Thread yvesd
For a bit more help about my previous message (outlook bar)
does anybody know how to reparent or change a widget(button)'s owner
in tkinter ?
here's my code that doesn't work :
def inverse(self):
if (self.texte=="top"):
self.texte="bottom"
btn = self
btn.pack_forget()
btn.configure(parent = self.top, text=self.texte)
btn.pack(side=TOP,fill=X,expand=1)
else:
self.texte="top"
btn = self
btn.pack_forget()
btn.configure(parent=self.bottom, text=self.texte)
btn.parent = None
btn.pack(side=BOTTOM,fill=X,expand=1)

-- 
http://mail.python.org/mailman/listinfo/python-list


TKinter newbie

2007-02-15 Thread Gigs_
Hi Im new to gui programming

from Tkinter import *  # get widget classes
from tkMessageBox import askokcancel   # get canned std dialog

class Quitter(Frame):  # subclass our GUI
 def __init__(self, parent=None):   # constructor method
 Frame.__init__(self, parent)
 self.pack()
 widget = Button(self, text='Quit', command=self.quit)
 widget.pack(side=LEFT)
 def quit(self):
 ans = askokcancel('Verify exit', "Really quit?")
 if ans: Frame.quit(self)

class Demo(Frame):
 def __init__(self, parent=None):
 Frame.__init__(self, parent)
 self.pack()
 Label(self, text="Basic demos").pack()
 for (key, value) in demos.items():
 func = (lambda key=key: self.printit(key))
 Button(self, text=key, command=func).pack(side=TOP, fill=BOTH)
 Quitter(self).pack()# here
 def printit(self, name):
 print name, 'returns =>', demos[name]()


My problem is in class Demo. How is the best way to use class Quitter in 
class Demo?
should it be:
Quitter(self).pack()
Quitter(self)
...
-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter __call__

2007-02-15 Thread Gigs_
from Tkinter import *
from tkFileDialog   import askopenfilename
from tkColorChooser import askcolor
from tkMessageBox   import askquestion, showerror
from tkSimpleDialog import askfloat

demos = {
 'Open':  askopenfilename,
 'Color': askcolor,
 'Query': lambda: askquestion('Warning', 'You typed  
"..."\nConfirm?'),
 'Error': lambda: showerror('Error!', "He's dead, Jim"),
 'Input': lambda: askfloat('Entry', 'Enter credit card number')
}


class Demo(Frame):
 def __init__(self, parent=None):
 Frame.__init__(self, parent)
 self.pack()
 Label(self, text="Basic demos").pack()
 for (key, value) in demos.items():
 func = (lambda key=key: self.printit(key))
 Button(self, text=key, command=func).pack(side=TOP, fill=BOTH)
 def printit(self, name):
 print name, 'returns =>', demos[name]()


I have tried but cant get it to work properly.
I want to instead printit method to put __call__ and call it like that
Can someone help me, please?
-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter menus

2007-03-01 Thread Gigs_
class MenuDemo(Frame):
 def __init__(self, parent=None):
 Frame.__init__(self, parent)
 self.pack(expand=YES, fill=BOTH)
 self.createWidgets()

 def createWidgets(self):
 self.makeMenuBar()
 self.makeToolBar()
 L = Label(self, text='Menu and Toolbar demo')
 L.config(relief=SUNKEN, width=40, height=10, bg='white')
 L.pack(expand=YES, fill=BOTH)

 def makeMenuBar(self):
 self.menubar = Menu(self.master)#here
 self.master.config(menu=self.menubar)   #here
 self.fileMenu()
 self.editMenu()
 self.imageMenu()

why i need to use self.master?
why i cant just use self?

thx
-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter menu

2007-03-07 Thread Gigs_
hi i have create widget with menu bar and menus on it.
when i resize my widget to less than menubar is than from
right to left menus on menubar goes to second row.
who to disable that?
all I want is that when i resize my widget to less size, that menus on 
menubar stays on default position .

thanks i advance
-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter error

2007-05-28 Thread BartlebyScrivener
Finally started trying to build a simple gui form for inserting text
data into a mysql db of quotations.

I found this nice Tkinter tutorial,

http://www.ibiblio.org/obp/py4fun/gui/tkPhone.html

but midway I'm getting an error.

from Tkinter import *

 >>> win = Tk()
>>> f = Frame(win)
>>> b1 = Button(f, "One")

Traceback (most recent call last):
  File "", line 1, in ?
  File "/usr/lib/python2.4/lib-tk/Tkinter.py", line 1936, in __init__
Widget.__init__(self, master, 'button', cnf, kw)
  File "/usr/lib/python2.4/lib-tk/Tkinter.py", line 1859, in __init__
BaseWidget._setup(self, master, cnf)
  File "/usr/lib/python2.4/lib-tk/Tkinter.py", line 1839, in _setup
if cnf.has_key('name'):
AttributeError: 'str' object has no attribute 'has_key'

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: TKinter

2006-06-10 Thread Chris Lambacher
GTK+ + Glade
http://pygtk.org/  

WxPython has several GUI editors
http://wxpython.org

PyQt has the ability to generate code from the Qt GUI designer
http://www.riverbankcomputing.co.uk/pyqt/

I personally have used GTK+ and Glade with great success.  I found WxPython to
be lacking in polish.  I have not worked with PyQt.

Pretty much all of the above work models are not embedded into an IDE.  There
is a GUI editor, and then you use your regular editor to write code.

This is actually a pretty good model because from my experience, as your
application becomes bigger and more complicated, you want less GUI generated
UI and more had written UI code.

-Chris

On Thu, Jun 08, 2006 at 10:29:44PM -, V Sivakumar wrote:
> Dear Group!,
> I am new to Python. I have Eclipse with Python support , is there 
> better IDE for free and with good support for GUI development. I need 
> to develop a nice looking desktop application. Like we could do in VB, 
> C# and Java Swing. Is there  a drag drop support GUI toolkit for 
> Python like the above languages do?
> 
> Thanks
> Siva
> 
> 
> 
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: TKinter

2006-06-11 Thread Chris Lambacher
I would try looking at Django or Turbogears.
http://www.djangoproject.com/
http://www.turbogears.org/

Also have a look at:
How to write a browser-based desktop app using CherryPy 2.0:
http://www.cherrypy.org/wiki/SingleClickAndRun
How to write a a browser-based desktop app using CherryPy 2.1:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/442481

-Chris

On Sat, Jun 10, 2006 at 10:25:53AM -0700, V Sivakumar wrote:
>Dear Chris,
> It is really very kind of you. Actually, I planned to do as a web
>program with a in built webserver. In that a the GUI creation becomes
>very easy. Is  Twisted (Python 2.4) a good option?
> 
>I find no good tutorials for Python programming. Like handling HTTPRequest
>and HTTPResponse.
> 
> 
>Kind Regards
>V Sivakumar
> 
>"You cannot know the meaning of your life until you are connected to the
>power that created you" - Shri Mataji Nirmala Devi. [1]www.tnsahaj.org.
> 
>- Original Message 
>From: Chris Lambacher <[EMAIL PROTECTED]>
>To: V Sivakumar <[EMAIL PROTECTED]>
>Cc: python-list@python.org
>Sent: Saturday, 10 June, 2006 9:26:38 AM
>Subject: Re: TKinter
> 
>GTK+ + Glade
>[2]http://pygtk.org/
> 
>WxPython has several GUI editors
>[3]http://wxpython.org
> 
>PyQt has the ability to generate code from the Qt GUI designer
>[4]http://www.riverbankcomputing.co.uk/pyqt/
> 
>I personally have used GTK+ and Glade with great success.  I found
>WxPython to
>be lacking in polish.  I have not worked with PyQt.
> 
>Pretty much all of the above work models are not embedded into an
>IDE.  There
>is a GUI editor, and then you use your regular editor to write code.
> 
>This is actually a pretty good model because from my experience, as your
>application becomes bigger and more complicated, you want less GUI
>generated
>UI and more had written UI code.
> 
>-Chris
> 
>On Thu, Jun 08, 2006 at 10:29:44PM -, V Sivakumar wrote:
>> Dear Group!,
>> I am new to Python. I have Eclipse with Python support , is there
>> better IDE for free and with good support for GUI development. I need
>> to develop a nice looking desktop application. Like we could do in VB,
>> C# and Java Swing. Is there  a drag drop support GUI toolkit for
>> Python like the above languages do?
>>
>> Thanks
>> Siva
>>
>>
>>
>>
>> --
>> [5]http://mail.python.org/mailman/listinfo/python-list
> 
> References
> 
>Visible links
>1. http://www.tnsahaj.org/
>2. http://pygtk.org/
>3. http://wxpython.org/
>4. http://www.riverbankcomputing.co.uk/pyqt/
>5. http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list


py2exe & tkinter

2006-06-12 Thread Robin Becker
Don't know if this is the right place to ask, but has anyone considered using 
something like tcl's freewrap code to integrate tkinter into py2xe single 
executables?

We currently use the (fairly clunky) nsis route to create single file 
executables with py2exe as input, but with the new bundle_files option it 
should 
be possible to integrate our tcl/tk stuff into a common library.zip as that 
seems to be the method used by freewrap.
-- 
Robin Becker

-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter question.

2006-06-17 Thread ak
Hi, I'd like to create buttons on the fly that will call the same
function, and the function in question has to know what was the name of
the button that called it. Unless there is a preferred way for doing
this.. Perhaps creating a new function on the fly along with the new
button? Please help.. thanks!

-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter problem

2006-07-07 Thread Jim Anderson

I'm running Kubuntu a derivative of Debian Linux. I'm using
Python 2.4 and tcl/tk 8.4. I'm running Tkinter programs and
they were running about a month ago. When I tried them again
yesterday, I got the following message:

 > python ~/prog/python/iodef/iodef.py
 > Traceback (most recent call last):
 >   File "/home/jja/prog/python/iodef/iodef.py", line 10, in ?
 > import pkgview
 >   File "/home/jja/prog/python/iodef/lib/pkgview.py", line 3, in ?
 > from Tkinter import *
 >   File "/usr/lib/python2.4/lib-tk/Tkinter.py", line 38, in ?
 > import _tkinter # If this fails your Python may not be configured 
 > for Tk
 > ImportError: /usr/lib/python2.4/lib-dynload/_tkinter.so: cannot open 
 > > shared object file: No such file or directory

My environment varibles, like PTYHONPATH and TK_LIBRIARY all look
correct and the tcl/tk and python librarys are all still in place.
There is a file '/usr/lib/python2.4/lib-dynload/_tkinter.so'. I'm
not sure if this is the file not being found, but that is what is
sounds like.

I did a search on this on the web and got some hits, but none of them
provide a solution to my problem.

Can anyone help with this problem?

Jim Anderson
-- 
http://mail.python.org/mailman/listinfo/python-list


tkinter wm_delete_window

2006-07-18 Thread yvesd
hello i want to intercept tkinter python system events like
wm_delete_window
and if possible for any window, but the newest code I've produced give
me
an error :

Traceback (most recent call last):
  File "C:\Documents and Settings\yvesd\Bureau\protowin.py", line 36,
in ?
b1 = Tkinter.Button (win1)
  File "C:\Python24\lib\lib-tk\Tkinter.py", line 1933, in __init__
Widget.__init__(self, master, 'button', cnf, kw)
  File "C:\Python24\lib\lib-tk\Tkinter.py", line 1856, in __init__
BaseWidget._setup(self, master, cnf)
  File "C:\Python24\lib\lib-tk\Tkinter.py", line 1834, in _setup
self.tk = master.tk
AttributeError: MyDlg instance has no attribute 'tk'

thanks a lot for the help answer.

here is my code :

import Tkinter
from Tkinter import *

class MyDlg(Toplevel):


def ma_fonction():
print "my function is finished."


def __init__(arg1, arg2):
arg1.protocol("WM_DELETE_WINDOW", arg1.ma_fonction)

root = Tkinter.Tk ()
#win1 = Tkinter.Toplevel (root)
win1 = MyDlg(root)
b1 = Tkinter.Button (win1)
b1.config (text="hello")

-- 
http://mail.python.org/mailman/listinfo/python-list


tkinter help

2006-07-18 Thread groves
hi eveyrbody , i have started working on python tkinter,
While I was working on one of the tkinter classes..named listbox
widget. I had a slight problem.

Now let me tell you that i was able to create a simple listbox which
had 6 options which one can select, but Now what I want is that from
the available menu, if I select an option it should give me another
menu associated with that option. Its like digging up that option to do
advance search.

Please I need help as I am making my project
Thanks to eveyrbody who will take time to read this and solve it .

-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter questions

2006-07-28 Thread Kevin Walzer
What is the recommended/preferred widget in Tkinter in the following areas:

1. Multi-column list display. I'm aware of bindings for Tktable,
tablelist, and mclistbox, as well as Python-megawidgets that handle this.

2.  Tree widgets. I'm aware of Gene Cash's tree widget, the IDLE tree
widget, as well as wrappers for BWidgets and tktreectrl.

Rather than wade through every one of these different widgets, I'd like
to get a sense of which ones are actually used in applications and why.
Thanks for any advice.


-- 
Kevin Walzer
Poetic Code
http://www.kevin-walzer.com
-- 
http://mail.python.org/mailman/listinfo/python-list


tkinter manual question

2004-11-29 Thread Sean McIlroy
The 'Canvas Methods' section of the online Intro to Tkinter
(http://www.pythonware.com/library/tkinter/introduction/x2102-methods.htm)
refers (without explanation) to something called "bbox". What is this?
TIA
-- 
http://mail.python.org/mailman/listinfo/python-list


Multithreading tkinter question

2004-12-15 Thread Mark English
Is there a safe way to run tkinter in a multithreaded app where the
mainloop runs in a background thread ?
Here's some test code demonstrating the problem. I'm running Python2.4
under Windows 2000.


Code snip starts-
from Tkinter import *

def GetTkinterThread():
import threading
def TestTkinter():
def greeting():
print "Hello stdout world !"

win = Frame()
win.pack()
Label(win, text="Hello container world").pack(side=TOP)
Button(win, text="Hello", command=greeting).pack(side=TOP)
Button(win, text="Quit", command=win.quit).pack(side=RIGHT)

win.mainloop()
#Run the mainloop in another thread
t = threading.Thread(None, TestTkinter, 'Test Tkinter Thread')
t.setDaemon(1)   #Keep going
t.start()
print 'Hi'
return t

t = GetTkinterThread() #This works fine

#Now press the "Hello" button on the Tkinter window
#Now press the return key at the python prompt

Code snip ends-
With a debug build the call stack looks like this:
python24_d.dll!Py_FatalError(const char * msg=0x1e23ca14)  Line
1513C
python24_d.dll!PyThreadState_Swap(_ts * new=0x0098d0b8)  Line
293 + 0xa   C
python24_d.dll!PyEval_RestoreThread(_ts * tstate=0x0098d0b8)
Line 309 + 0x9  C
_tkinter_d.pyd!EventHook()  Line 2969 + 0xc C
python24_d.dll!my_fgets(char * buf=0x009ef3e8, int len=100,
_iobuf * fp=0x1027c838)  Line 46C
python24_d.dll!PyOS_StdioReadline(_iobuf * sys_stdin=0x1027c838,
_iobuf * sys_stdout=0x1027c858, char * prompt=0x0087f974)  Line 125 +
0x11C
python24_d.dll!PyOS_Readline(_iobuf * sys_stdin=0x1027c838,
_iobuf * sys_stdout=0x1027c858, char * prompt=0x0087f974)  Line 205 +
0x12C

Is this because of access to sys.stdout ? Or some deeper darker problem
? Is there a right way to achieve this ? Basically I want to be able to
call a function from the Python prompt which creates a Tkinter window
(not necessarily interactive apart from a close button) to display some
data, but leaves the Python prompt active so I can carry on from there.

Haven't found anything about this yet. All sample multithreaded Tkinter
code I've seen uses the main thread as the GUI thread. Also, should I be
posting this to another newsgroup ?

Thanks for any help,
Mark


---
The information contained in this e-mail is confidential and solely 
for the intended addressee(s). Unauthorised reproduction, disclosure, 
modification, and/or distribution of this email may be unlawful. If you 
have received this email in error, please notify the sender immediately 
and delete it from your system. The views expressed in this message 
do not necessarily reflect those of LIFFE Holdings Plc or any of its subsidiary 
companies.
---

--
http://mail.python.org/mailman/listinfo/python-list


cosmetic Tkinter question

2004-12-26 Thread Sean McIlroy
I've got a bunch of Frames, all packed into the root window with
side=TOP, and in each Frame I've got a Checkbutton packed with
side=LEFT. I expected the Checkbuttons to be flush with the left edge
of the window, but they're not, and it looks a little gross. How do I
get them to align?
-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter vs wxPython

2004-12-27 Thread Esmail Bonakdarian
Greetings all.
I will have about 2 weeks to pursue some Python related activities and
would like to learn more about the graphical end of things. In that
vein I would like some opinions regarding Tkinter and wxPython.
(The previously recommended PyGame is appropriate for me for now, but
I am looking ahead)
I am especially interested in terms of learning curve, documentation,
portability across platforms Linux/Windows and anything else you care
to add. As I know only what I have read on this forum & surfing the
web I would really appreciate the input of those who have used both,
or decided to use one over the other.
Thanks a bunch,
Esmail
ps: this is basically the same query as posted December 10 “Re: GUIs:
wxPython vs. Tkinter (and others)”
--
http://mail.python.org/mailman/listinfo/python-list


Tkinter (OOP?) help

2004-12-30 Thread 3c273
Hello,
I am trying to expand on a tutorial I am working through and I am not
understanding something. In the following example if you click on the "New
window" button, a new window appears with a "Close me" button in it and if
you click on it's "Close me" button, it works. But, if you click the
original "New window" button two or more times, the "Close me" button only
works on one of the new windows. Furthermore, if you click "Close me" on the
first new window, it closes the last window to open, not the one that you
clicked on. How do I bind a "closeme2" function to each new window? Any help
is appreciated.

Louis

--begin code--
from Tkinter import *

class MyApp:
def __init__(self, parent):
self.myparent = parent
self.frame1 = Frame(parent)
self.frame1.pack()

self.btn1 = Button(self.frame1, text='Do nothing', bg='green')
self.btn1.pack(side=LEFT)

self.btn2 = Button(self.frame1, text='Close me', fg='white',
bg='red')
self.btn2.pack(side=LEFT)
self.btn2.bind('', self.closeme)

self.btn3 = Button(self.frame1, text='New window?', bg='grey')
self.btn3.pack(side=LEFT)
self.btn3.bind('', self.newwindow)

def closeme(self, event):
self.myparent.destroy()

def newwindow(self, event):
self.new = Toplevel(self.myparent)
self.frame2 = Frame(self.new)
self.frame2.pack()

self.btn4 = Button(self.frame2, text='Close me', fg='white',
bg='red')
self.btn4.pack()
self.btn4.bind('', self.closeme2)

def closeme2(self, event):
self.new.destroy()

root = Tk()
root.title('Tk Test Program')
myapp = MyApp(root)
root.mainloop()


-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter zoom box

2005-01-03 Thread Philippe C. Martin
Hi,

I have the following convern: I have Tkinter applications that require a zoom 
box, and have had the following behavior without changing a line of code:

1) Mandrake 10.0/KDE 3.2/Python 2.3: no zoom box 
2) Mandrake 10.0/KDE 3.2/Python 2.4: zoom box shows
3) Mandrake 10.1/KDE 3.3/Python 2.4: no zoom box
4) Mandrake 10.1/Gnome 2.6/Python 2.4: zoom box shows

I know that sounds strange, but I am fairly certain this is what happened.

Is there a way to _force_ that zoom box ?

Regards,

Philippe




-- 
*
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
*
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter Puzzler

2005-01-07 Thread Eric Brunel
Tim Daneliuk wrote:
I am trying to initialize a menu in the following manner:
for entry in [("Up", KeyUpDir), ("Back", KeyBackDir), ("Home", 
KeyHomeDir), ("Startdir", KeyStartDir), ("Root", KeyRootDir)]:

func = entry[1]
UI.ShortBtn.menu.add_command(label=entry[0], command=lambda: 
func(None))

However, at runtime, each of the menu options binds to the *last* function
named in the list (KeyStartDir).
Explicitly loading each entry on its own line works fine:
UIcommand=lambda:KeyWHATEVERDir(None)
Any ideas why the first form does not fly?
This has nothing to do with Tkinter, but only with the way nested scopes work: 
to put it roughly, your "lambda: func(None)" only knows about the *name* func, 
which is not actually evaluated until the button is pressed. And when the button 
is pressed, the name func is bound to the last command in the loop.

To do what you want, change your code to:
for entry in (...):
  UI.ShortBtn.menu.add_command(
label=entry[0],
command=lambda func=entry[1]: func(None)
  )
This way, the value for the func parameter is evaluated when the function is 
defined and not when it is called.

HTH
--
- Eric Brunel  -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter Puzzler

2005-01-07 Thread F. Petitjean
Le 07 Jan 2005 05:28:31 EST, Tim Daneliuk a écrit :
> I am trying to initialize a menu in the following manner:
> 
> for entry in [("Up", KeyUpDir), ("Back", KeyBackDir), ("Home", KeyHomeDir), 
> ("Startdir", KeyStartDir), ("Root", 
> KeyRootDir)]:
> 
>  func = entry[1]
>  UI.ShortBtn.menu.add_command(label=entry[0], command=lambda: func(None))
The problem is that you *call* the callback : the command parameter is
bound to the result of func(None)
> 
> However, at runtime, each of the menu options binds to the *last* function
> named in the list (KeyStartDir).
> 
> Explicitly loading each entry on its own line works fine:
> 
> UIcommand=lambda:KeyWHATEVERDir(None)
> 
> Any ideas why the first form does not fly?
I would simplify the code like ;

add_cmd = UI.ShortBtn.menu.add_command
for label, func in (("Up", KeyUpDir),  ):
add_cmd(label=label, command=func)

And have
def KeyUpDir(arg=None):
# whatever

> 
> 
> TIA,
> 
> Tim Daneliuk [EMAIL PROTECTED]
> PGP Key: http://www.tundraware.com/PGP/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter Puzzler

2005-01-07 Thread Alex Martelli
Tim Daneliuk <[EMAIL PROTECTED]> wrote:

> I am trying to initialize a menu in the following manner:
> 
> for entry in [("Up", KeyUpDir), ("Back", KeyBackDir), ("Home",
> KeyHomeDir), ("Startdir", KeyStartDir), ("Root", KeyRootDir)]:
> 
>  func = entry[1]
>  UI.ShortBtn.menu.add_command(label=entry[0], command=lambda: func(None))
> 
> However, at runtime, each of the menu options binds to the *last* function
> named in the list (KeyStartDir).
> 
> Explicitly loading each entry on its own line works fine:
> 
> UIcommand=lambda:KeyWHATEVERDir(None)
> 
> Any ideas why the first form does not fly?

One word: late binding.  Well, two, pedantically speaking;-).

The lambda you're passing as the value for 'command' is a closure: it
knows it will have to look up name 'func' in the environment in which
it's embedded -- but also that it's meant to do that lookup as late as
possible, each time it's called.

If you wanted to do the lookup just once, at the time lambda executes
and created an anonymous function rather than each time said anonymous
function is called, you could have expressed that...:
command=lambda func=func: func(None)
Here, func is a local variable (argument) of the anonymous function, and
its "default value" is set ONCE, when the anon function is created.

Back to your code, when your anon function is called, it looks up name
'func' in the surrounding environment... and there it finds it bound to
whatever it was RE-bound to the LAST time...


Point to remember: a closure looks up free-variable names in its
surrounding environment *as late as possible*, i.e., when the function
object is called; while default argument values are evaluated *at
function creation time* (when lambda or def executes, not when the
resulting function object gets called).


Alex
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter Puzzler

2005-01-07 Thread Tim Daneliuk
Tim Daneliuk wrote:
I am trying to initialize a menu in the following manner:
for entry in [("Up", KeyUpDir), ("Back", KeyBackDir), ("Home", 
KeyHomeDir), ("Startdir", KeyStartDir), ("Root", KeyRootDir)]:

func = entry[1]
UI.ShortBtn.menu.add_command(label=entry[0], command=lambda: 
func(None))

However, at runtime, each of the menu options binds to the *last* function
named in the list (KeyStartDir).
Explicitly loading each entry on its own line works fine:
UIcommand=lambda:KeyWHATEVERDir(None)
Any ideas why the first form does not fly?
TIA,
 

Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
Thanks All - great responses!
--

Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
--
http://mail.python.org/mailman/listinfo/python-list


reusing Tkinter Canvases

2005-01-14 Thread Sean McIlroy
I'd like to save one Tkinter Canvas in order to use it on another
Canvas later. The problem is that it gets saved as EPS but it needs to
be GIF to be reuseable. How can I convert that format?

Peace,
STM
-- 
http://mail.python.org/mailman/listinfo/python-list


tkinter socket client ?

2005-01-20 Thread Tonino
I have been looking through the previous posts - but with my lack of
knowledge on the whole tkinter subject - I have no clue what to look
for ...

SO - can anyone please help with this ...?

I have a python server that when it gets a connection from a client -
it sends data back - quite a bit of it - in discreet parts - around
1024 byte chunks ...

I have created a tkinter client that makes a simple connect to the
server.  What I have a problem with is I need the client to write all
the data to the Text() widget created in the GUI client - the Text()
widget is created as :

self.text=Text(self.center_frame,background='white')
scroll=Scrollbar(self.center_frame)
self.text.configure(yscrollcommand=scroll.set)

self.text.pack(side=LEFT, fill=BOTH, expand=YES)
scroll.pack(side=RIGHT,fill=Y)
self.center_frame.pack(side=RIGHT, expand=YES, fill=BOTH)


I have a button with "Connect" written on it that connects to the
server by calling :

HOST = 'localhost'
PORT = 9000
global s
for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC,
socket.SOCK_STREAM):
af, socktype, proto, canonname, sa = res
try:
s = socket.socket(af, socktype, proto)
except socket.error, msg:
s = None
continue
try:
s.connect(sa)
except socket.error, msg:
s.close()
s = None
continue
break
if s is None:
print 'could not open socket'
self.quitButtonClick

NOW - HOW do I get the server's sent data to continuiosly print in the
Text() widget ?

Many thank
Tonino

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Tkinter] problem

2005-01-29 Thread Jeff Epler
These lines
> if __name__ == '__main__':
> OptionsWindow()
mean "if this source code is the main program (not an imported module),
call OptionsWindow()".  So the behavior should be different when the
source code is the main program ('python opt_newlogin.py') and when it's
imported ('python -c "import opt_newlogin"')

Jeff


pgpCSdrstdRnI.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: broke tkinter

2005-02-08 Thread wes weston
Philippe C. Martin wrote:
Hi,
I decided to clean my system and rebuild python from scratch.
I downloaded tk8.4.9, tcl8.4.9 and Python2-4.tar.bz2.
I installed tcl then tk using './configure --prefix=/usr'
tkcvs is now working OK
trying to compile python (configure = './configure --prefix=/usr', I get
this:
In file included
from /home/philippe/downloaded/Python-2.4/Modules/_tkinter.c:67:
/usr/include/tk.h:337: error: syntax error before "CONST84"
In file included from /usr/include/tk.h:1576,
from /home/philippe/downloaded/Python-2.4/Modules/_tkinter.c:67:
Any clue!
Regards,
Philippe

Phillipp,
   Might you be getting the wrong header file/tk version?
http://wiki.tcl.tk/3669  talks about it.
wes
--
http://mail.python.org/mailman/listinfo/python-list


Re: broke tkinter

2005-02-08 Thread Philippe C. Martin
I'll check, thanks.

Philippe



On Tue, 08 Feb 2005 18:03:11 +, wes weston wrote:

> Philippe C. Martin wrote:
>> Hi,
>> 
>> I decided to clean my system and rebuild python from scratch.
>> 
>> I downloaded tk8.4.9, tcl8.4.9 and Python2-4.tar.bz2.
>> 
>> I installed tcl then tk using './configure --prefix=/usr'
>> 
>> tkcvs is now working OK
>> 
>> 
>> trying to compile python (configure = './configure --prefix=/usr', I get
>> this:
>> 
>> 
>> In file included
>> from /home/philippe/downloaded/Python-2.4/Modules/_tkinter.c:67:
>> /usr/include/tk.h:337: error: syntax error before "CONST84"
>> In file included from /usr/include/tk.h:1576,
>> 
>> from /home/philippe/downloaded/Python-2.4/Modules/_tkinter.c:67:
>> 
>> Any clue!
>> 
>> Regards,
>> 
>> Philippe
>> 
>> 
> Phillipp,
> Might you be getting the wrong header file/tk version?
> 
> http://wiki.tcl.tk/3669  talks about it.
> 
> wes

-- 
http://mail.python.org/mailman/listinfo/python-list


tkinter absorb chars

2005-03-03 Thread phil
Sorry for the repost, but moderator
jeld the last one,
In a Tkinter entry field (or Pmw entry)
how could I eat charactres?
Say a certain char is keyed in. Say &
I notice in the event handler for .
I don't want any more charactres to display or
be in the field until I handle, in the
event handler, another character. Say ?
Can the event handler somehow destroy the chars
in the meantime?
Thanks
--
http://mail.python.org/mailman/listinfo/python-list


HELP: Python & Tkinter ?

2005-03-07 Thread PGMoscatt
Hi all,

Have just installed Fedora 3 and wish also want to give programming with
Python a go.  I wish to develop GUI interfaces and believe that 'Tkinter'
is the way to go.

After installing Python frpm the distro CD I can't use the 'from Tkinter
import *' command. When I try, I get the error message below:

ImportError: No module named Tkinter

So from that I assume I need to install Tkinter ?
Should I also find this on the CD ?  Is it known as another name as looking
on the CD I don't seem to find anything relating to Tkinter.

Thanks in advance.

Pete

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python & Tkinter ?

2005-03-07 Thread Fredrik Lundh
"PGMoscatt" wrote:

> Have just installed Fedora 3 and wish also want to give programming with
> Python a go.  I wish to develop GUI interfaces and believe that 'Tkinter'
> is the way to go.
>
> After installing Python frpm the distro CD I can't use the 'from Tkinter
> import *' command. When I try, I get the error message below:
>
> ImportError: No module named Tkinter
>
> So from that I assume I need to install Tkinter ?
> Should I also find this on the CD ?  Is it known as another name as looking
> on the CD I don't seem to find anything relating to Tkinter.

according to

http://tkinter.unpythonic.net/wiki/How_20to_20install_20Tkinter

this should do the trick:

yum install tkinter

 



-- 
http://mail.python.org/mailman/listinfo/python-list


  1   2   3   4   5   6   7   8   9   10   >