From stewart.midwinter at gmail.com Thu Jan 5 01:39:09 2006 From: stewart.midwinter at gmail.com (Stewart Midwinter) Date: Wed, 4 Jan 2006 17:39:09 -0700 Subject: [Tkinter-discuss] Fwd: tkinter on Cygwin In-Reply-To: References: Message-ID: I'm testing a small Tkinter app on Cygwin, and have noted a problem behaviour with tkMessageBox showinfo method (I presume the problem would also occur with showwarning or showerror). Msg text in the showinfo dialog is not visible, nor is the text in the OK button. If I put the same message text into a label and display that label in a Toplevel widget, the text is visible. I note that tkMessageBox code (created by Fredrik Lundh way back in 1997!) inherits from Dialog, and passes options to it. I wonder if, in cygwin, I need to explicity set a font family or type, or a text colour, and if so, how to do that? I tried adding a font parameter to the showinfo method call, but it only accepts default, icon, message, parent, title or type. thanks, -- Stewart Midwinter stewart at midwinter.ca stewart.midwinter at gmail.com Skype, GoogleTalk, iChatAV, MSN, Yahoo: midtoad AIM:midtoad1 From stewart.midwinter at gmail.com Thu Jan 5 03:02:01 2006 From: stewart.midwinter at gmail.com (Stewart Midwinter) Date: Wed, 4 Jan 2006 19:02:01 -0700 Subject: [Tkinter-discuss] subprocess problem in cygwin with Tkinter Message-ID: this has me puzzled; I've created a small test app to show the problem I'm having. I want to use subprocess to execute system commands from inside a Tkinter app running under Cygwin. When I open a python interpreter and run my subprocess command, all is well. But when I run the same command from inside a Tkinter app, I'm getting errors. I'm using this version of Cygwin: $ uname -a CYGWIN_NT-5.1 Mulata 1.5.18(0.132/4/2) 2005-07-02 20:30 i686 unknown unknown Cyg win When I run my command in a python shell, all is well: smidwint at Mulata /cygdrive/c/programs/pipeworksb/lib/python/popt $ python Python 2.4.1 (#1, May 27 2005, 18:02:40) [GCC 3.3.3 (cygwin special)] on cygwin Type "help", "copyright", "credits" or "license" for more information. >>> import subprocess >>> dirlist = subprocess.Popen('/usr/bin/ls', shell=True, bufsize=2048, stdout= subprocess.PIPE).stdout >>> dirlist ', mode 'rb' at 0x49d848> >>> for dir in dirlist: ... print dir ... __init__.pyc browser.bat test_subprocess.py test_subprocess.py.bak >>> When I run the same command in a Tkinter app, I get an exception: smidwint at Mulata /cygdrive/c/programs/pipeworksb/lib/python/popt $ python test_subprocess.py d:\cygwin\bin\python2.4.exe (7752): *** unable to remap d:\cygwin\bin\tk84.dll t o same address as parent(0x18C40000) != 0x18C50000 9 [main] python 4696 fork_parent: child 7752 died waiting for dll loading Traceback (most recent call last): File "test_subprocess.py", line 19, in ? l = Tkinter.Label(text=dir_list()) File "test_subprocess.py", line 8, in dir_list dirlist = subprocess.Popen('/usr/bin/ls', shell=True, bufsize=2048, stdout=s ubprocess.PIPE).stdout File "/usr/lib/python2.4/subprocess.py", line 558, in __init__ errread, errwrite) File "/usr/lib/python2.4/subprocess.py", line 918, in _execute_child self.pid = os.fork() OSError: [Errno 2] No such file or directory Here's a sample Tkinter app that reproduces the problem: #test_subprocess.py import subprocess, os import Tkinter def dir_list(): '''provide a listing of files in a directory''' #need to know which system to draw from curdir = os.getcwd() dirlist = subprocess.Popen('/usr/bin/ls', shell=True, bufsize=2048, stdout=subprocess.PIPE).stdout #dirlist = subprocess.Popen(['ls',' -l'], stdout=subprocess.PIPE).stdout.communicate()[0] print dirlist msgList = [] for dir in dirlist: print dir msgList.append(dir) msg = '\n'.join(msgList) return msg root = Tkinter.Tk() l = Tkinter.Label(text=dir_list()) l.pack() b = Tkinter.Button(text='ok',command=root.destroy) b.pack() root.mainloop() BTW, the test_subprocess.py test script that ships with Cygwin python runs fine. any ideas? thanks, -- Stewart Midwinter stewart at midwinter.ca stewart.midwinter at gmail.com Skype, GoogleTalk, iChatAV, MSN, Yahoo: midtoad AIM:midtoad1 From m_tayseer82 at yahoo.com Thu Jan 5 11:55:07 2006 From: m_tayseer82 at yahoo.com (Mohammad Tayseer) Date: Thu, 5 Jan 2006 02:55:07 -0800 (PST) Subject: [Tkinter-discuss] Tix and Pmw comparison In-Reply-To: <20051229150531.GA19069@lairds.us> Message-ID: <20060105105507.62158.qmail@web31104.mail.mud.yahoo.com> I added the wiki page at http://tkinter.unpythonic.net/wiki/TixVsPmwVsBWidgets your opinions are appreciated --------------------------------- Yahoo! Photos Ring in the New Year with Photo Calendars. Add photos, events, holidays, whatever. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/tkinter-discuss/attachments/20060105/7635d7c4/attachment.html From stewart.midwinter at gmail.com Thu Jan 5 21:26:14 2006 From: stewart.midwinter at gmail.com (Stewart Midwinter) Date: Thu, 5 Jan 2006 13:26:14 -0700 Subject: [Tkinter-discuss] Pmw problem in cygwin with Tkinter Message-ID: I have a Tkinter app running on cygwin. It includes a Test menu item that does nothing more than fetch a directory listing and display it in a Toplevel window (I'd use a tkMessageBox showinfo widget, but for some reason the text is invisible on cygwin). After I close the Toplevel widget, all of the menus in my app behave as though they have no contents to them, i..e I can press on the File menu button, and see it depress, but the Exit submenu does not appear (and neither do any of the other menus' submenus). However, a Quit button in my status bar does respond, so the problem lies with the menu. Below are two apps that illustrate the problem. It's obvious that the problem is with Pmw, and in particular with the menubar widget. The first test app uses Pmw, and displays the problem behaviour. The second test app uses basic Tk menus, and does not have a problem. Any clues? --- #test_subprocess3.py from Tkinter import * import os, sys import subprocess programHome = '/cygdrive/c/programs' sys.path[:0] = [programHome] try: import Pmw except ImportError: print 'I need to have Pmw widget set installed in c:\\Programs\\Pmw' sys.exit("missing Pmw") class PumpAdmin(Pmw.MegaWidget): def __init__(self, parent): #master=None): Pmw.MegaWidget.__init__(self, parent) #Frame.__init__(self, master, relief=SUNKEN, bd=2) self.parent = parent def drawGui(self): '''draw the application''' # Create the Balloon. self.balloon = Pmw.Balloon(self.parent) #---------- Menu bar --------------- if 1: menuBar=Pmw.MenuBar(self.parent, hull_relief='raised', hull_borderwidth=1) menuBar.pack(fill='x') self.menuBar = menuBar menuBar.addmenu('File', 'Close this window or exit') menuBar.addmenuitem('File', 'command', 'Exit the application', command=root.destroy, label='Exit') menuBar.addmenu('Test', 'Test new features') menuBar.addmenuitem('Test', 'command', 'Directory listing', command=self.dir_list, label='Directory List') # ------- Paned widget (central part of main window) ------- if 1: panedWidget = Pmw.PanedWidget(self.parent, orient = 'vertical', hull_height = 250, hull_width = 500) self.panedWidget = panedWidget self.panedWidget.add('results', min = 0.05) self.panedWidget.pack(side='left', fill = 'both', expand = 1) self.results = Pmw.ScrolledText(self.panedWidget.pane('results'), text_wrap = 'none') self.results.pack(fill = 'both', expand = 1) # ----------------------- Status Bar -------------------------- if 1: self.panedWidget.add('status', min = 0.05) frmS = Frame(self.panedWidget.pane('status')) self.frmS = frmS frmS.pack(fill='x', expand=1) labSpaceL = Label(frmS, text = ' ') labSpaceR = Label(frmS, text = ' ') labSystem = Button(frmS, text = 'Quit', command=root.destroy) self.labSystem = labSystem labSpaceL.pack(side='left') self.labSystem.pack(side='left', fill='both',expand=0) labSpaceR.pack(side='right') def dir_list(self): '''provide a listing of files in a directory''' curdir = os.getcwd() try: p = subprocess.Popen(['ls',' -l'], bufsize=2048, shell=True, close_fds=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (child_stdin, dirlist, retcode) = (p.stdin, p.stdout, p.stderr) if retcode < 0: print >>sys.stderr, "Child was terminated by signal", retcode print 'error' self.myshowerror("Error","Sorry, couldn't get a directory listing") else: print 'no error' #print dirlist msgList = [] for dir in dirlist: #print dir msgList.append(dir) msg = ''.join(msgList) #print msg print 'got to 1' self.myshowinfo("Directory Listing for %s" % curdir, msg) print 'got to 2' #self.drawMenu() except OSError,e: print >>sys.stderr, "Execution failed:", e def mymessage(self, title, msg, msgType='info'): '''a workalike for the tkMessageBox showinfo since the former results in invisible text in cygwin''' top = Toplevel() top.title(title) t = Label(top, text='\n%s\n' % msgType.upper()) t.pack() l = Label(top, text=msg) l.pack() b = Button(top,text="Ok", command=top.destroy) b.pack() def myshowinfo(self, title='', msg=''): '''a workalike for the tkMessageBox showinfo since the former results in invisible text in cygwin''' self.mymessage(title, msg,'info') root.focus_set() root.update() if __name__ == '__main__': if 1: root = Tk() Pmw.initialise(root, size = 16, useTkOptionDb = 1) root.geometry('500x400+100+100') root.title("Test application") app = PumpAdmin(root) app.drawGui() app.pack(fill = 'both', expand = 1) root.deiconify() root.update() root.mainloop() --- #test_subprocess2.py from Tkinter import * import os, sys import subprocess class AppUI(Frame): def __init__(self, master=None): Frame.__init__(self, master, relief=SUNKEN, bd=2) def drawGui(self): self.drawMenu() self.drawCanvas() def drawMenu(self): self.menubar = Menu(self) menu = Menu(self.menubar, tearoff=0) self.menubar.add_cascade(label="File", menu=menu) menu.add_command(label="Exit", command=root.destroy) menu = Menu(self.menubar, tearoff=0) self.menubar.add_cascade(label="Test", menu=menu) menu.add_command(label="Dir list", command=self.dir_list) try: self.master.config(menu=self.menubar) except AttributeError: # master is a toplevel window (Python 1.4/Tkinter 1.63) self.master.tk.call(master, "config", "-menu", self.menubar) def drawCanvas(self): self.canvas = Canvas(self, bg="white", width=400, height=400, bd=0, highlightthickness=0) self.canvas.pack() def dir_list(self): '''provide a listing of files in a directory''' #need to know which system to draw from curdir = os.getcwd() try: #dirlist = subprocess.Popen('ls -l', shell=False, bufsize=2048, stdout=subprocess.PIPE).stdout #dirlist,retcode = subprocess.Popen('ls -l', stdout=subprocess.PIPE).communicate() #retcode = subprocess.call('ls -l', shell=False) p = subprocess.Popen(['ls',' -l'], bufsize=2048, shell=True, close_fds=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (child_stdin, dirlist, retcode) = (p.stdin, p.stdout, p.stderr) if retcode < 0: print >>sys.stderr, "Child was terminated by signal", retcode print 'error' self.myshowerror("Error","Sorry, couldn't get a directory listing") else: print 'no error' #print dirlist msgList = [] for dir in dirlist: #print dir msgList.append(dir) msg = ''.join(msgList) #print msg print 'got to 1' self.myshowinfo("Directory Listing for %s" % curdir, msg) print 'got to 2' self.drawMenu() except OSError,e: print >>sys.stderr, "Execution failed:", e def mymessage(self, title, msg, msgType='info'): '''a workalike for the tkMessageBox showinfo since the former results in invisible text in cygwin''' top = Toplevel() top.title(title) t = Label(top, text='\n%s\n' % msgType.upper()) t.pack() l = Label(top, text=msg) l.pack() b = Button(top,text="Ok", command=top.destroy) b.pack() def myshowinfo(self, title='', msg=''): '''a workalike for the tkMessageBox showinfo since the former results in invisible text in cygwin''' self.mymessage(title, msg,'info') root.focus_set() root.update() root = Tk() app = AppUI(root) app.drawGui() app.pack() root.mainloop() thanks, -- Stewart Midwinter stewart at midwinter.ca stewart.midwinter at gmail.com Skype, GoogleTalk, iChatAV, MSN, Yahoo: midtoad AIM:midtoad1 From stewart.midwinter at gmail.com Sat Jan 7 05:52:05 2006 From: stewart.midwinter at gmail.com (Stewart Midwinter) Date: Fri, 6 Jan 2006 21:52:05 -0700 Subject: [Tkinter-discuss] Tix and Pmw comparison In-Reply-To: <20060105105507.62158.qmail@web31104.mail.mud.yahoo.com> References: <20051229150531.GA19069@lairds.us> <20060105105507.62158.qmail@web31104.mail.mud.yahoo.com> Message-ID: Mohammed, thanks for putting that outline together. It will be quite useful when completed. My suggestion would be to put the comparisons at the top of the page, including your views on the pros and cons of each widget set. The actual list of what each widget set includes could come later. Or better yet, delegate each list of widgets to its own page - that would be more readable. (OOPS - just read your stuff at the page bottom, where you make the same suggestions). I noted that the Notebook page appears in several places, but the example is from only one widget set. The EntryField link appears under Pmw but the example is from Tkinter. A couple of other notes I would make: you can add a pros and cons for basic Tkinter, since it is the default choice. e.g. pros - comes with all python installations and is available on all platforms - smallest footprint of any widget set - extensive documentation is available cons - some people think it's ugly Another thing about Pmw. Currently I'm working on a Tkinter app running on python in the cygwin environment. I've found some weirdness (invisible text on tkMessageBox widgets like showinfo), non-functioning MenuBar widgets after doing a subprocess fork, etc. I'm having (for now) to revert to basic Tkinter widgets. Other cons to Tix, bwidget: - can be problematic to install on some platforms; some users have problems getting python to find the widget set (raw tk commands may be needed). cheers, -- Stewart Midwinter stewart at midwinter.ca stewart.midwinter at gmail.com Skype, GoogleTalk, iChatAV, MSN, Yahoo: midtoad AIM:midtoad1 From klappnase at freenet.de Sat Jan 7 19:09:26 2006 From: klappnase at freenet.de (Michael Lange) Date: Sat, 7 Jan 2006 19:09:26 +0100 Subject: [Tkinter-discuss] Pmw problem in cygwin with Tkinter In-Reply-To: References: Message-ID: <20060107190926.4518e84b.klappnase@freenet.de> On Thu, 5 Jan 2006 13:26:14 -0700 Stewart Midwinter wrote: Hi Stewart, > I have a Tkinter app running on cygwin. It includes a Test menu item > that does nothing more than fetch a directory listing and display it > in a Toplevel window (I'd use a tkMessageBox showinfo widget, but for > some reason the text is invisible on cygwin). > > After I close the Toplevel widget, all of the menus in my app behave > as though they have no contents to them, i..e I can press on the File > menu button, and see it depress, but the Exit submenu does not appear > (and neither do any of the other menus' submenus). However, a Quit > button in my status bar does respond, so the problem lies with the > menu. > > Below are two apps that illustrate the problem. It's obvious that the > problem is with Pmw, and in particular with the menubar widget. The > first test app uses Pmw, and displays the problem behaviour. The > second test app uses basic Tk menus, and does not have a problem. > > Any clues? > Sorry, I don't have much ideas here; however on my linux box your test app runs fine, and if tkMessageBox does not work either it does not seem so obvious to me that Pmw causes the problems. Regards Michael From stewart.midwinter at gmail.com Sat Jan 7 19:26:40 2006 From: stewart.midwinter at gmail.com (Stewart Midwinter) Date: Sat, 7 Jan 2006 11:26:40 -0700 Subject: [Tkinter-discuss] Pmw problem in cygwin with Tkinter In-Reply-To: <20060107190926.4518e84b.klappnase@freenet.de> References: <20060107190926.4518e84b.klappnase@freenet.de> Message-ID: On 1/7/06, Michael Lange wrote: > Sorry, I don't have much ideas here; however on my linux box your test app > runs fine, and if tkMessageBox does not work either it does not seem so > obvious to me that Pmw causes the problems. Hi Michael - you tested my apps on a linux box and not on cygwin? The apps run fine on linux, it's cygwin that is the problem. S -- Stewart Midwinter stewart at midwinter.ca stewart.midwinter at gmail.com Skype, GoogleTalk, iChatAV, MSN, Yahoo: midtoad AIM:midtoad1 From klappnase at web.de Sun Jan 8 17:09:06 2006 From: klappnase at web.de (Michael Lange) Date: Sun, 8 Jan 2006 17:09:06 +0100 Subject: [Tkinter-discuss] Pmw problem in cygwin with Tkinter In-Reply-To: References: <20060107190926.4518e84b.klappnase@freenet.de> Message-ID: <20060108170906.7be1a1d3.klappnase@web.de> On Sat, 7 Jan 2006 11:26:40 -0700 Stewart Midwinter wrote: Hi Stewart, > > you tested my apps on a linux box and not on cygwin? The apps run > fine on linux, it's cygwin that is the problem. > that's what I thought, it's just because you wrote that you think it's Pmw that causes the problems. Unfortunately I don't have a windows box here for testing. Have you tried to narrow down the problem, for example do the Pmw demos work? I think on windows Tk uses for both the MessageBox and the menus native windows controls, so I think the problem might be running Tk from cygwin. Regards Michael From amanjit.gill at gmx.de Sun Jan 8 19:03:57 2006 From: amanjit.gill at gmx.de (Amanjit Gill) Date: Sun, 08 Jan 2006 19:03:57 +0100 Subject: [Tkinter-discuss] Pmw problem in cygwin with Tkinter In-Reply-To: References: Message-ID: <43C1540D.2020601@gmx.de> Steward MidWinter wrote: >in a Toplevel window (I'd use a tkMessageBox showinfo widget, but for >some reason the text is invisible on cygwin). > For some reason (FSR), tkMessageBox is *visible* on my cygwin :-) >After I close the Toplevel widget, all of the menus in my app behave >as though they have no contents to them, i..e I can press on the File > FSR, I cannot reproduce this UI anomaly with pmw on my cygwin installation. >Below are two apps that illustrate the problem. It's obvious that the >problem is with Pmw, and in particular with the menubar widget. The > FSR, Pmw itself works fine on my installation. But FSR, I cannot run your sample unmodified because cygwin cannot fork - had to put things into dirlist manually for a test. $ python /test_subprocess2.py C:\cygwin\bin\python2.4.exe (2524): *** unable to remap C:\cygwin\bin\tk84.dll to same address as parent(0x18700000) != 0x18C10000 23 [main] python 596 fork_parent: child 2524 died waiting for dll loading Execution failed: (0, 'Error') Bottom line: I think cygwin is too much of a moving target. An example: FSR in my old install "ssh-add " always hanged on the first invocation. After pressing control-c and rerunning ssh-add everything works (FSR!). System: - Windows 2003 Server Std Edition - Python 2.4.1 (#1, May 27 2005, 18:02:40) [GCC 3.3.3 (cygwin special)] on cygwin - Pmw 1.2 - Cygwin Base 1.3.20a-2 Btw, cygwin + tkinter / pmw seems to create the exact same native widgets on my system and do not use X (XWin.exe). Greetings, ________________________ Amanjit Gill Software Developer neofonie Technologieentwicklung und Informationsmanagement GmBH Robert-Koch-Platz 4 10115 Berlin amanjit at neofonie.de // work amanjit.gill at gmx.de // private DISCLAIMER Any opinion expressed in this post is the personal opinion of Amanjit Gill and can in no way be constructed as an official statement by his employer From stewart.midwinter at gmail.com Sun Jan 8 22:02:33 2006 From: stewart.midwinter at gmail.com (Stewart Midwinter) Date: Sun, 8 Jan 2006 14:02:33 -0700 Subject: [Tkinter-discuss] Pmw problem in cygwin with Tkinter In-Reply-To: <43C1540D.2020601@gmx.de> References: <43C1540D.2020601@gmx.de> Message-ID: On 1/8/06, Amanjit Gill wrote: > > Bottom line: I think cygwin is too much of a moving target. well you may be right. We've got other issues with it as well, not involving python. But we have to use it since we have to deploy a unix app on a windows box, and we don't have time or resources to port the app to windows at this time. for now I'll try to steer clear of Pmw and just use native Tkinter widgets. No problem with any of them so far. cheers S From m_tayseer82 at yahoo.com Mon Jan 9 22:11:33 2006 From: m_tayseer82 at yahoo.com (Mohammad Tayseer) Date: Mon, 9 Jan 2006 13:11:33 -0800 (PST) Subject: [Tkinter-discuss] Pmw problem in cygwin with Tkinter In-Reply-To: Message-ID: <20060109211133.1380.qmail@web31115.mail.mud.yahoo.com> and we don't have time or resources to port the app to windows at this time. try to steer clear of Pmw and just use native Tkinter widgets. No problem with any of them so far. i dont know why will you rewrite the Pmw part and not changing the console commands themselves. i rewrote the commands in the code snippet you sent before to use windows commands and it worked --------------------------------- Yahoo! Photos Got holiday prints? See all the ways to get quality prints in your hands ASAP. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/tkinter-discuss/attachments/20060109/05a5f82d/attachment.htm From stewart.midwinter at gmail.com Mon Jan 9 22:41:38 2006 From: stewart.midwinter at gmail.com (Stewart Midwinter) Date: Mon, 9 Jan 2006 14:41:38 -0700 Subject: [Tkinter-discuss] Pmw problem in cygwin with Tkinter In-Reply-To: <20060109211133.1380.qmail@web31115.mail.mud.yahoo.com> References: <20060109211133.1380.qmail@web31115.mail.mud.yahoo.com> Message-ID: On 1/9/06, Mohammad Tayseer wrote: > i dont know why will you rewrite the Pmw part and not changing the console > commands themselves. i rewrote the commands in the code snippet you sent > before to use windows commands and it worked Perhaps I wasn't very clear on the nature of the problem. As Mohammed states, my example apps work fine under Windows. But those little apps aren't part of the unix app. I'm trying to create a Tkinter administrative app for that unix app, and communicate with it via subprocess, then display information in Tkinter widgets, rather than force the user to use vi as his interface! The problem that I'm finding is that the Pmw widgets don't behave properly when run in cygwin. I want my Tkinter admin app to run in cygwin, like the unix app, to simplify communication with the unix app. since by definition I have windows available on the workstation in addition to cygwin, perhaps my approach should be to write my admin app using the Windows version of Tkinter. That way Pmw will function properly. However, I'll have to then start cygwin via subprocess and send additional chained commands to cygwin to get the unix app to run. I'll think about that approach for a while.. S From m_tayseer82 at yahoo.com Mon Jan 9 23:14:39 2006 From: m_tayseer82 at yahoo.com (Mohammad Tayseer) Date: Mon, 9 Jan 2006 14:14:39 -0800 (PST) Subject: [Tkinter-discuss] Pmw problem in cygwin with Tkinter In-Reply-To: Message-ID: <20060109221439.85255.qmail@web31104.mail.mud.yahoo.com> hmmm, i would use another approach. I would reimplement all the underlying commands and leave the other parts untouched. you may find some commands similar (like cd) and you will implement only the non-existing commands (like ls) which, i think, won't be too many --------------------------------- Yahoo! Photos Ring in the New Year with Photo Calendars. Add photos, events, holidays, whatever. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/tkinter-discuss/attachments/20060109/1fdf0ff9/attachment.html From stewart.midwinter at gmail.com Mon Jan 9 23:18:44 2006 From: stewart.midwinter at gmail.com (Stewart Midwinter) Date: Mon, 9 Jan 2006 15:18:44 -0700 Subject: [Tkinter-discuss] Pmw problem in cygwin with Tkinter In-Reply-To: <20060109221439.85255.qmail@web31104.mail.mud.yahoo.com> References: <20060109221439.85255.qmail@web31104.mail.mud.yahoo.com> Message-ID: On 1/9/06, Mohammad Tayseer wrote: > hmmm, i would use another approach. I would reimplement all the underlying > commands and leave the other parts untouched. you may find some commands > similar (like cd) and you will implement only the non-existing commands > (like ls) which, i think, won't be too many you mean, implement the Tkinter app in windows, and use windows commands wherever possible, only invoking cygwin where absolutely necessary? S From francois.schnell at gmail.com Tue Jan 10 12:12:31 2006 From: francois.schnell at gmail.com (francois schnell) Date: Tue, 10 Jan 2006 12:12:31 +0100 Subject: [Tkinter-discuss] Keeping keyboard focus when window iconified (Win XP) ? Message-ID: <13a83ca10601100312u5d7469dah@mail.gmail.com> Hello, I'm doing a small program to capture screenshots. But obviously I don't wan my GUI to be visible during the sreenshots and I want to continue to take sreenshots (with my key binding) even when the program doesn't have the main focus anymore. I'm running Python 2.4 on Win XP Family. Do you have an idea how I could do this ? Thanks in advance francois --- import sys, os, msvcrt, Image, ImageGrab from Tkinter import * from os import chdir def exitapp(): fen1.quit() fen1.destroy() i=0 def screenshot(event): fen1.iconify() global i print " screen !" i= i+1 name = "session1picture" name= name + str(i) print name myscreen= ImageGrab.grab() myscreen.show() myscreen.save("C:/"+name+ '.jpeg') fen1.deiconify() def invisible(): fen1.iconify() #GUI launch fen1=Tk() fen1.title("Screenshots Tests") bu11=Button(fen1, text='screenshot') fen1.bind("s",screenshot) #fen1.bind_all("s",screenshot) bu11.bind("",screenshot) buQuit=Button(fen1, width= 20, text='Quitter',command=exitapp) bu12=Button(fen1, text='invisible', command=invisible) bu11.pack() bu12.pack() buQuit.pack() fen1.mainloop() -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/tkinter-discuss/attachments/20060110/529f3baa/attachment.html From amanjit.gill at gmx.de Tue Jan 10 13:05:38 2006 From: amanjit.gill at gmx.de (Amanjit Gill) Date: Tue, 10 Jan 2006 13:05:38 +0100 Subject: [Tkinter-discuss] Keeping keyboard focus when window iconified (Win XP) ? In-Reply-To: <13a83ca10601100312u5d7469dah@mail.gmail.com> References: <13a83ca10601100312u5d7469dah@mail.gmail.com> Message-ID: <43C3A312.9020209@gmx.de> Hi there ui updates with tkinter will only happen IMHO after your method returns. use the widget.after() method (check http://infohost.nmt.edu/tcc/help/pubs/tkinter/universal.html). Something like this: def screenshot(event): fen1.iconify() fen1.after(200,doscreen) i=0 def doscreen(): global i print " screen !" i= i+1 name = "session1picture" name= name + str(i) print name myscreen= ImageGrab.grab() myscreen.show() myscreen.save("C:/"+name+ '.jpeg') fen1.deiconify() If you want ro remove the taskbar entry you can apply the win32 style MYWS_EX_NOACTIVATE (at least with win2000 or later). This requires C programming, and is just the first thing that came into my mind. cheers Amanjit Singh Gill >Hello, > >I'm doing a small program to capture screenshots. > >But obviously I don't wan my GUI to be visible during the sreenshots and I >want to continue to take sreenshots (with my key binding) even when the >program doesn't have the main focus anymore. > >I'm running Python 2.4 on Win XP Family. > >Do you have an idea how I could do this ? > >Thanks in advance > >francois > >--- >import sys, os, msvcrt, Image, ImageGrab >from Tkinter import * >from os import chdir > >def exitapp(): > fen1.quit() > fen1.destroy() > >i=0 >def screenshot(event): > fen1.iconify() > global i > print " screen !" > i= i+1 > name = "session1picture" > name= name + str(i) > print name > myscreen= ImageGrab.grab() > myscreen.show() > myscreen.save("C:/"+name+ '.jpeg') > fen1.deiconify() > >def invisible(): > fen1.iconify() > >#GUI launch >fen1=Tk() >fen1.title("Screenshots Tests") >bu11=Button(fen1, text='screenshot') >fen1.bind("s",screenshot) >#fen1.bind_all("s",screenshot) >bu11.bind("",screenshot) >buQuit=Button(fen1, width= 20, text='Quitter',command=exitapp) >bu12=Button(fen1, text='invisible', command=invisible) > >bu11.pack() >bu12.pack() >buQuit.pack() > >fen1.mainloop() > > > >------------------------------------------------------------------------ > >_______________________________________________ >Tkinter-discuss mailing list >Tkinter-discuss at python.org >http://mail.python.org/mailman/listinfo/tkinter-discuss > From amanjit.gill at gmx.de Tue Jan 10 13:08:27 2006 From: amanjit.gill at gmx.de (Amanjit Gill) Date: Tue, 10 Jan 2006 13:08:27 +0100 Subject: [Tkinter-discuss] errata Keeping keyboard focus when window iconified (Win XP) ? In-Reply-To: <43C3A312.9020209@gmx.de> References: <13a83ca10601100312u5d7469dah@mail.gmail.com> <43C3A312.9020209@gmx.de> Message-ID: <43C3A3BB.6040408@gmx.de> Amanjit Gill wrote: > >MYWS_EX_NOACTIVATE (at least with win2000 or later). This requires C > WS_EX_NOACTIVATE, sorry Greetings From m_tayseer82 at yahoo.com Tue Jan 10 14:45:51 2006 From: m_tayseer82 at yahoo.com (Mohammad Tayseer) Date: Tue, 10 Jan 2006 05:45:51 -0800 (PST) Subject: [Tkinter-discuss] Pmw problem in cygwin with Tkinter In-Reply-To: Message-ID: <20060110134551.64898.qmail@web31114.mail.mud.yahoo.com> you mean, implement the Tkinter app in windows, and use windows commands wherever possible, only invoking cygwin where absolutely necessary? not exactly. I meant: 1. leave the *Pmw* version untouched 2. leave the original application untouched 3. don't use cygwin. instead, implement the missing commands yourself; possibly by writing wrappers around windows commands I hope I'd clarified it --------------------------------- Yahoo! DSL Something to write home about. Just $16.99/mo. or less -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/tkinter-discuss/attachments/20060110/8e7362e8/attachment.html From francois.schnell at gmail.com Tue Jan 10 18:17:21 2006 From: francois.schnell at gmail.com (francois schnell) Date: Tue, 10 Jan 2006 18:17:21 +0100 Subject: [Tkinter-discuss] Keeping keyboard focus when window iconified (Win XP) ? In-Reply-To: <43C3A312.9020209@gmx.de> References: <13a83ca10601100312u5d7469dah@mail.gmail.com> <43C3A312.9020209@gmx.de> Message-ID: <13a83ca10601100917q2275d9afg@mail.gmail.com> Thanks very much Gill for the UI update help. I've also found something very interesting to control the app when it's not in focus anymore with pyHook: The pyHook library wraps the low-level mouse and keyboard hooks in the Windows Hooking API for use in Python applications. This short tutorial demonstrates how to set keyboard and mouse hooks, what information is available about events, and how to pass or block events. http://www.cs.unc.edu/~parente/tech/tr08.shtml Python rocks :) cheers francois On 10/01/06, Amanjit Gill wrote: > > Hi there > > ui updates with tkinter will only happen IMHO after your method returns. > use the widget.after() method (check > http://infohost.nmt.edu/tcc/help/pubs/tkinter/universal.html) > . > Something > like this: > > def screenshot(event): > fen1.iconify() > fen1.after(200,doscreen) > > i=0 > def doscreen(): > global i > print " screen !" > i= i+1 > name = "session1picture" > name= name + str(i) > print name > myscreen= ImageGrab.grab() > myscreen.show() > myscreen.save("C:/"+name+ '.jpeg') > fen1.deiconify() > > If you want ro remove the taskbar entry you can apply the win32 style > MYWS_EX_NOACTIVATE (at least with win2000 or later). This requires C > programming, and is just the first thing that came into my mind. > > cheers > Amanjit Singh Gill > > >Hello, > > > >I'm doing a small program to capture screenshots. > > > >But obviously I don't wan my GUI to be visible during the sreenshots and > I > >want to continue to take sreenshots (with my key binding) even when the > >program doesn't have the main focus anymore. > > > >I'm running Python 2.4 on Win XP Family. > > > >Do you have an idea how I could do this ? > > > >Thanks in advance > > > >francois > > > >--- > >import sys, os, msvcrt, Image, ImageGrab > >from Tkinter import * > >from os import chdir > > > >def exitapp(): > > fen1.quit() > > fen1.destroy() > > > >i=0 > >def screenshot(event): > > fen1.iconify() > > global i > > print " screen !" > > i= i+1 > > name = "session1picture" > > name= name + str(i) > > print name > > myscreen= ImageGrab.grab() > > myscreen.show() > > myscreen.save("C:/"+name+ '.jpeg') > > fen1.deiconify() > > > >def invisible(): > > fen1.iconify() > > > >#GUI launch > >fen1=Tk() > >fen1.title("Screenshots Tests") > >bu11=Button(fen1, text='screenshot') > >fen1.bind("s",screenshot) > >#fen1.bind_all("s",screenshot) > >bu11.bind("",screenshot) > >buQuit=Button(fen1, width= 20, text='Quitter',command=exitapp) > >bu12=Button(fen1, text='invisible', command=invisible) > > > >bu11.pack() > >bu12.pack() > >buQuit.pack() > > > >fen1.mainloop() > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Tkinter-discuss mailing list > >Tkinter-discuss at python.org > > http://mail.python.org/mailman/listinfo/tkinter-discuss > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/tkinter-discuss/attachments/20060110/1b09a5e9/attachment.htm From fredrik at pythonware.com Sat Jan 14 09:52:01 2006 From: fredrik at pythonware.com (Fredrik Lundh) Date: Sat, 14 Jan 2006 09:52:01 +0100 Subject: [Tkinter-discuss] Pmw problem in cygwin with Tkinter References: <20060110134551.64898.qmail@web31114.mail.mud.yahoo.com> Message-ID: mohammad, can you please use a quoting approach that makes it explicit what message you're replying to (including who wrote it), and works also if people read your messages as plain text. as it is now, most of the messages from you looks like this example and we don't have time or resources to port the app to windows at this time. try to steer clear of Pmw and just use native Tkinter widgets. No problem with any of them so far. i dont know why will you rewrite the Pmw part and not changing the console commands themselves. i rewrote the commands in the code snippet you sent before to use windows commands and it worked which would be a bit more readable as, say Stewart Midwinter wrote: > ... and we don't have time or resources to port the > app to windows at this time. > for now I'll try to steer clear of Pmw and just use native > Tkinter widgets. No problem with any of them so far. i dont know why will you rewrite the Pmw part and not changing the console commands themselves. i rewrote the commands in the code snippet you sent before to use windows commands and it worked at least in the context of this mailing list (your poetry teacher may prefer the former, though). From m_tayseer82 at yahoo.com Sat Jan 14 13:20:45 2006 From: m_tayseer82 at yahoo.com (Mohammad Tayseer) Date: Sat, 14 Jan 2006 04:20:45 -0800 (PST) Subject: [Tkinter-discuss] Pmw problem in cygwin with Tkinter In-Reply-To: Message-ID: <20060114122045.30281.qmail@web31104.mail.mud.yahoo.com> > Fredrik Lundh wrote: > mohammad, can you please use a quoting approach that makes it > explicit what message you're replying to (including who wrote it), > and works also if people read your messages as plain text. I think this is clearer. --------------------------------- Yahoo! Photos Ring in the New Year with Photo Calendars. Add photos, events, holidays, whatever. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/tkinter-discuss/attachments/20060114/2a039cae/attachment.htm From klappnase at web.de Wed Jan 18 14:07:34 2006 From: klappnase at web.de (Michael Lange) Date: Wed, 18 Jan 2006 14:07:34 +0100 Subject: [Tkinter-discuss] Drawing waveform on a Canvas Message-ID: <20060118140734.7b9513c0.klappnase@web.de> Hello list, I am trying to draw a graphical representation of a soundfile (a.k.a. waveform) onto a Canvas, however I am not sure where to start. I have used the SnackCanvas before (http://www.speech.kth.se/snack) and it is pretty cool, however for several reasons I don't want to use the Snack package anymore and I wonder how to achieve something like Snack's create_waveform() method in plain Tkinter. Just in case you don't know exactly what I am talking about, a short description of what SnackCanvas.create_waveform() does: When called first on a soundfile, this file is scanned for peak values (which takes a while, on my box here about 70 seconds for a 30 minute wav-file); the information gained herein is then stored in a so called "shape file" (a binary file of unknown format, which is about 600 kB for a 30 minute wav-file) which makes it very fast to load the waveform again later on (about one second). The item returned by create_waveform() can then be treated like any other Canvas item; especially cool features are, that with camvas.itemconfigure(item, height=...) you can stretch the waveform vertically, and with canvas.itemconfigure(item, pixelspersecond=...) you can "zoom" into the waveform horizontally, which is both pretty fast, too. Now, trying to get something similar without Snack, I found there are several ways to scan the soundfile, of which the most promising seems to me the audioop.maxpp() method. I tried to store the information I get from audioop.maxpp() in a reasonable amount of time and ended with a 700 kB text file filled with integer values, and there I am stuck. Does anyone have an idea, if it is possible to put this information together to a usable Canvas item, and if yes, where to go (polygon? image?). Any ideas are much appreciated. Thanks in advance. Michael From stewart.midwinter at gmail.com Wed Jan 18 18:46:35 2006 From: stewart.midwinter at gmail.com (Stewart Midwinter) Date: Wed, 18 Jan 2006 10:46:35 -0700 Subject: [Tkinter-discuss] Drawing waveform on a Canvas In-Reply-To: <20060118140734.7b9513c0.klappnase@web.de> References: <20060118140734.7b9513c0.klappnase@web.de> Message-ID: On 1/18/06, Michael Lange wrote: > I have used the SnackCanvas before (http://www.speech.kth.se/snack) and it is pretty cool, I don't have any answers for you, but thanks for the pointer to SnackCanvas - that is an interesting toolkit for sure! s From m_tayseer82 at yahoo.com Wed Jan 18 20:41:26 2006 From: m_tayseer82 at yahoo.com (Mohammad Tayseer) Date: Wed, 18 Jan 2006 11:41:26 -0800 (PST) Subject: [Tkinter-discuss] Drawing waveform on a Canvas In-Reply-To: <20060118140734.7b9513c0.klappnase@web.de> Message-ID: <20060118194127.38565.qmail@web31115.mail.mud.yahoo.com> Michael Lange wrote: > Hello list, > > I am trying to draw a graphical representation of a soundfile > (a.k.a. waveform) onto a Canvas, You have two problems 1. Reading a sound file 2. drawing the waveform I solved the 2nd problem only. This is a code that draws a random waveform. --------------------------------------------------------------------------------- from Tkinter import * import random import math import time def fun(zoom=.1): t1 = time.time() global c # remove the old shapes. for item in c.find_all(): c.delete(item) # calculate a random amplitude amplitude = random.random() * int(c.winfo_height()) / 2 points = [] for x in range(0, c.winfo_width()): y = math.sin(x * math.pi / (zoom*180)) * amplitude + int(c.winfo_height()) / 2 points.append(x) points.append(y) # now points should be of form [x0, y0, x1, y1, ...] # not [(x0, y0), ...] c.create_line(smooth=1, *points) c.update_idletasks() # to draw the shapes immediately. print 'Timing:', time.time() - t1 root = Tk() c = Canvas(root, bg='beige') c.pack(expand=1, fill=BOTH) Button(root, text='Do waveform', command=fun).pack() mainloop() --------------------------------------------------------------------------------- It took 0.0310001373291 second to execute fun() in full-screen mode. I don't think customizing this will be a problem, but you know you can always ask. --------------------------------- Yahoo! Photos Got holiday prints? See all the ways to get quality prints in your hands ASAP. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/tkinter-discuss/attachments/20060118/c98a0b48/attachment.html From klappnase at web.de Thu Jan 19 01:29:40 2006 From: klappnase at web.de (Michael Lange) Date: Thu, 19 Jan 2006 01:29:40 +0100 Subject: [Tkinter-discuss] Drawing waveform on a Canvas In-Reply-To: <20060118194127.38565.qmail@web31115.mail.mud.yahoo.com> References: <20060118140734.7b9513c0.klappnase@web.de> <20060118194127.38565.qmail@web31115.mail.mud.yahoo.com> Message-ID: <20060119012940.2f4fb500.klappnase@web.de> On Wed, 18 Jan 2006 11:41:26 -0800 (PST) Mohammad Tayseer wrote: > You have two problems > 1. Reading a sound file > 2. drawing the waveform > > I solved the 2nd problem only. This is a code that draws a random waveform. Thanks Mohammad, you are right, the line item looks very good. The problem is that I have a real large number of coords here, so my 30-minute test file at a resolution of 100 pixels / second takes more than 20 seconds to draw and then it sucks up more than 20% of my computer's memory (says top). I haven't tried zooming yet... I think using an image may be a better chance, so I tried to use the canvas to create a postscript that I could then convert into a gif, however the canvas wrote a 10 MB ps file that made convert crash when trying to open it. Any ideas? Michael From m_tayseer82 at yahoo.com Thu Jan 19 09:04:32 2006 From: m_tayseer82 at yahoo.com (Mohammad Tayseer) Date: Thu, 19 Jan 2006 00:04:32 -0800 (PST) Subject: [Tkinter-discuss] Drawing waveform on a Canvas In-Reply-To: <20060119012940.2f4fb500.klappnase@web.de> Message-ID: <20060119080432.39240.qmail@web31115.mail.mud.yahoo.com> > Michael Lange wrote: > On Wed, 18 Jan 2006 11:41:26 -0800 (PST) > Mohammad Tayseer wrote: > > >> You have two problems >>1. Reading a sound file >> 2. drawing the waveform >> >> I solved the 2nd problem only. This is a code that draws a random waveform. > >Thanks Mohammad, > > you are right, the line item looks very good. > The problem is that I have a real large number of coords here, so my 30-minute > test file > at a resolution of 100 pixels / second takes more than 20 seconds to draw and > then it sucks up more > than 20% of my computer's memory (says top). > I haven't tried zooming yet... > > I think using an image may be a better chance, so I tried to use the canvas to > create a postscript > that I could then convert into a gif, however the canvas wrote a 10 MB ps > file that made convert crash > when trying to open it. > > Any ideas? > > Michael What is the relationship you want to draw? frequency vs. time or what? frequency/time requires only 1 chart, but other relationships requires more than one, which may suggest using another widget. --------------------------------- Yahoo! Photos Ring in the New Year with Photo Calendars. Add photos, events, holidays, whatever. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/tkinter-discuss/attachments/20060119/5fa90576/attachment.htm From m_tayseer82 at yahoo.com Thu Jan 19 09:05:20 2006 From: m_tayseer82 at yahoo.com (Mohammad Tayseer) Date: Thu, 19 Jan 2006 00:05:20 -0800 (PST) Subject: [Tkinter-discuss] Drawing waveform on a Canvas In-Reply-To: <20060119012940.2f4fb500.klappnase@web.de> Message-ID: <20060119080520.37865.qmail@web31114.mail.mud.yahoo.com> > Michael Lange wrote: > On Wed, 18 Jan 2006 11:41:26 -0800 (PST) > Mohammad Tayseer wrote: > > >> You have two problems >>1. Reading a sound file >> 2. drawing the waveform >> >> I solved the 2nd problem only. This is a code that draws a random waveform. > >Thanks Mohammad, > > you are right, the line item looks very good. > The problem is that I have a real large number of coords here, so my 30-minute > test file > at a resolution of 100 pixels / second takes more than 20 seconds to draw and > then it sucks up more > than 20% of my computer's memory (says top). > I haven't tried zooming yet... > > I think using an image may be a better chance, so I tried to use the canvas to > create a postscript > that I could then convert into a gif, however the canvas wrote a 10 MB ps > file that made convert crash > when trying to open it. > > Any ideas? > > Michael What is the relationship you want to draw? frequency vs. time or what? frequency/time requires only 1 chart, but other relationships requires more than one, which may suggest using another widget. --------------------------------- Yahoo! Photos Got holiday prints? See all the ways to get quality prints in your hands ASAP. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/tkinter-discuss/attachments/20060119/c7a1b02d/attachment-0001.html From fredrik at pythonware.com Thu Jan 19 10:30:16 2006 From: fredrik at pythonware.com (Fredrik Lundh) Date: Thu, 19 Jan 2006 10:30:16 +0100 Subject: [Tkinter-discuss] Drawing waveform on a Canvas References: <20060118140734.7b9513c0.klappnase@web.de><20060118194127.38565.qmail@web31115.mail.mud.yahoo.com> <20060119012940.2f4fb500.klappnase@web.de> Message-ID: Michael Lange wrote: > The problem is that I have a real large number of coords > here, so my 30-minute test file at a resolution of 100 pixels > / second takes more than 20 seconds to draw and then it > sucks up more than 20% of my computer's memory (says > top). I haven't tried zooming yet... the WCK allows you to draw directly from Python data structures: http://effbot.org/zone/wck.htm From klappnase at web.de Thu Jan 19 13:30:12 2006 From: klappnase at web.de (Michael Lange) Date: Thu, 19 Jan 2006 13:30:12 +0100 Subject: [Tkinter-discuss] Drawing waveform on a Canvas In-Reply-To: References: <20060118140734.7b9513c0.klappnase@web.de> <20060118194127.38565.qmail@web31115.mail.mud.yahoo.com> <20060119012940.2f4fb500.klappnase@web.de> Message-ID: <20060119133012.60c077b6.klappnase@web.de> Frederik, Mohammad, Stewart, thanks to all of you. On Thu, 19 Jan 2006 00:04:32 -0800 (PST) Mohammad Tayseer wrote: > What is the relationship you want to draw? frequency vs. time or what? > frequency/time requires only 1 chart, but other relationships requires more than one, which may suggest using another widget. > It's peak level vs. time; the purpose of my app is to display the graphical representation of a (possibly very large) soundfile to make it easy to determine track borders in e.g. a recorded vinyl album or tape cassette. I am not sure if "waveform" is the correct term here, Snack calls it that way. The screenshot at the bottom of shows what it is supposed to look like, however this one is only about two minutes wheras I need to draw much bigger soundfiles. The fact that the gap between two tracks may be very short is why I need to be able to stretch it horizontally. The reason why I don't want to use Snack anymore is that with Snack I had serious problems with simple audio operations; I could still use Snack only for drawing the waveform, however Snack is a little "unfriendly" when it tries to access the sound card, making it impossible to start the program e.g. when esd or artsd are running (BTW, my app is supposed to run on linux only), that's why I want to look for an alternative. On Thu, 19 Jan 2006 10:30:16 +0100 "Fredrik Lundh" wrote: > the WCK allows you to draw directly from Python data structures: > > http://effbot.org/zone/wck.htm > On Wed, 18 Jan 2006 18:43:08 -0700 Stewart Midwinter wrote: > If you have data from another source, what about using pylab > (matplotlib) to create the sine-wave plot and save it to an image, > then display that image on the canvas? I've used the toolkit for a > project and it works quite well. Thanks, I will check what mathplotlib and WCK can do for me (and probably come back with further questions later ,-). Best regards Michael From msolem at linuxmail.org Mon Jan 23 19:06:53 2006 From: msolem at linuxmail.org (Michael Solem) Date: Mon, 23 Jan 2006 13:06:53 -0500 Subject: [Tkinter-discuss] Hyperterm type program and text box Message-ID: <20060123180653.2EEEA3AA515@ws5-8.us4.outblaze.com> Hello, I want to create a program to talk to the com port (something like hyperterminal or minicom). The display should be a box that outputs characters as they come in (from the port), and accepts characters as input, which it sends to the port. Characters entered on the screen should not be shown on the screen (which is the default behavior of hyperterm and minicom). I was planning on using the Tkinter Text widget for this, but see no way of having the user enter data, without it showing up on the screen. Is there a way to do that? Is there another widget that can do it? Thanks, Mike -- ______________________________________________ Check out the latest SMS services @ http://www.linuxmail.org This allows you to send and receive SMS through your mailbox. Powered by Outblaze From klappnase at web.de Mon Jan 23 19:37:31 2006 From: klappnase at web.de (Michael Lange) Date: Mon, 23 Jan 2006 19:37:31 +0100 Subject: [Tkinter-discuss] Hyperterm type program and text box In-Reply-To: <20060123180653.2EEEA3AA515@ws5-8.us4.outblaze.com> References: <20060123180653.2EEEA3AA515@ws5-8.us4.outblaze.com> Message-ID: <20060123193731.379becb4.klappnase@web.de> On Mon, 23 Jan 2006 13:06:53 -0500 "Michael Solem" wrote: > Hello, > > I want to create a program to talk to the com port > (something like hyperterminal or minicom). The display should be a > box that outputs characters as they come in (from the port), and > accepts characters as input, which it sends to the port. Characters > entered on the screen should not be shown on the screen (which is the > default behavior of hyperterm and minicom). > > I was planning on using the Tkinter Text widget for this, but see no > way of having the user enter data, without it showing up on the > screen. Is there a way to do that? Is there another widget that can > do it? > Hi Michael, you need to bind a special callback to the KeyPress events, like this one: >>> from Tkinter import * >>> root = Tk() >>> text = Text(root) >>> text.pack(fill=BOTH, expand=1) >>> def keypress(event): ... print event.keysym ... return 'break' ... >>> text.bind('', keypress) As you see in the example you can use the event.keysym attribute to catch the character that would have been entered into the Text widget and the return "break" statement to prevent the event from being delivered to the Text widget's insertion mechanism. I hope this helps Michael From gilcneth at earthlink.net Fri Jan 27 02:18:41 2006 From: gilcneth at earthlink.net (gilcneth at earthlink.net) Date: Thu, 26 Jan 2006 20:18:41 -0500 Subject: [Tkinter-discuss] HTML Viewer Message-ID: <410-22006152711841953@earthlink.net> I am wondering what ideas people could offer for a simple HTML viewer I could plug into a Tkinter/Pmw Application. Does anyone know of something simple, yet robust? Thanking you in advance, Christopher A. Nethery gilcneth at earthlink.net -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/tkinter-discuss/attachments/20060126/c85b5dfe/attachment.html From fredrik at pythonware.com Fri Jan 27 08:52:18 2006 From: fredrik at pythonware.com (Fredrik Lundh) Date: Fri, 27 Jan 2006 08:52:18 +0100 Subject: [Tkinter-discuss] HTML Viewer References: <410-22006152711841953@earthlink.net> Message-ID: gilcneth at earthlink.net wrote: > I am wondering what ideas people could offer for a simple HTML viewer > I could plug into a Tkinter/Pmw Application. Does anyone know of some- > thing simple, yet robust? define simple. From gilcneth at earthlink.net Fri Jan 27 18:44:08 2006 From: gilcneth at earthlink.net (gilcneth at earthlink.net) Date: Fri, 27 Jan 2006 12:44:08 -0500 Subject: [Tkinter-discuss] HTML Viewer Message-ID: <410-22006152717448453@earthlink.net> I was afraid you might ask that : ). I am working on an application that would allow an end-user to view locally-saved web-pages and print them, if needed. The viewer would not be required to interact with the web. However, all formatting (CSS, etc.) would have to be maintained. Web-pages would also generally include images. I definately would not require a full-fledged browser, just a viewer that allows printing. Am I oversimplifying here? Should a different approach be taken, such as converting the webpage to .pdf? Thank You and Best Regards, Christopher Nethery > [Original Message] > From: Fredrik Lundh > To: > Date: 1/27/2006 4:52:35 AM > Subject: Re: [Tkinter-discuss] HTML Viewer > > gilcneth at earthlink.net wrote: > > > I am wondering what ideas people could offer for a simple HTML viewer > > I could plug into a Tkinter/Pmw Application. Does anyone know of some- > > thing simple, yet robust? > > define simple. > > > > > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss From Cameron at Phaseit.net Fri Jan 27 21:43:08 2006 From: Cameron at Phaseit.net (Cameron Laird) Date: Fri, 27 Jan 2006 20:43:08 +0000 Subject: [Tkinter-discuss] HTML Viewer In-Reply-To: <410-22006152711841953@earthlink.net> References: <410-22006152711841953@earthlink.net> Message-ID: <20060127204308.GA14040@lairds.us> On Thu, Jan 26, 2006 at 08:18:41PM -0500, gilcneth at earthlink.net wrote: . . . > I am wondering what ideas people could offer for a simple HTML viewer I could plug into a Tkinter/Pmw Application. Does anyone know of something simple, yet robust? . . . If you're reduced to researching this on your own, will interest you. From stewart.midwinter at gmail.com Fri Jan 27 21:51:51 2006 From: stewart.midwinter at gmail.com (Stewart Midwinter) Date: Fri, 27 Jan 2006 13:51:51 -0700 Subject: [Tkinter-discuss] HTML Viewer In-Reply-To: <20060127204308.GA14040@lairds.us> References: <410-22006152711841953@earthlink.net> <20060127204308.GA14040@lairds.us> Message-ID: On 1/27/06, Cameron Laird wrote: . > If you're reduced to researching this on your own, > will interest you. Cameron, I see that mention is made of lwidgets, a new set of widgets built from other widgets. None of those have been added to Tkinter's set of widgets, have they? Off the top of your head, do you know of a good tutorial page for someone wanting to create Tkinter wrappers for Tk widgets? thanks, -- Stewart Midwinter stewart at midwinter.ca stewart.midwinter at gmail.com Skype, GoogleTalk, iChatAV, MSN, Yahoo: midtoad AIM:midtoad1 From gilcneth at earthlink.net Sat Jan 28 04:33:15 2006 From: gilcneth at earthlink.net (gilcneth at earthlink.net) Date: Fri, 27 Jan 2006 22:33:15 -0500 Subject: [Tkinter-discuss] HTML Viewer Message-ID: <410-2200616283331562@earthlink.net> That's excellent! It never occurred to me to check whether something like this existed in tcl. At first glance, it looks like the HTML display library with table support ('htmllib3_4.zip') might work, with a Python wrapper. I haven't found much yet on wrapper howtos--but Jeff Epler's PyBwidgets wrapper seems as good a place as any to begin learning how to do this, since the wrapper has so far worked elegantly for me. Thank you for your help! -- Chris Nethery > [Original Message] > From: Stewart Midwinter > To: > Cc: Tkinter of Python > Date: 1/27/2006 5:51:55 PM > Subject: Re: [Tkinter-discuss] HTML Viewer > > On 1/27/06, Cameron Laird wrote: > . > > If you're reduced to researching this on your own, > > will interest you. > > Cameron, I see that mention is made of lwidgets, a new set of widgets > built from other widgets. None of those have been added to Tkinter's > set of widgets, have they? > > Off the top of your head, do you know of a good tutorial page for > someone wanting to create Tkinter wrappers for Tk widgets? > > thanks, > > -- > Stewart Midwinter > stewart at midwinter.ca > stewart.midwinter at gmail.com > Skype, GoogleTalk, iChatAV, MSN, Yahoo: midtoad > AIM:midtoad1 > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss From klappnase at web.de Mon Jan 30 12:02:18 2006 From: klappnase at web.de (Michael Lange) Date: Mon, 30 Jan 2006 12:02:18 +0100 Subject: [Tkinter-discuss] HTML Viewer In-Reply-To: <410-22006152711841953@earthlink.net> References: <410-22006152711841953@earthlink.net> Message-ID: <20060130120218.3ad3b9ac.klappnase@web.de> On Thu, 26 Jan 2006 20:18:41 -0500 "gilcneth at earthlink.net" wrote: > I am wondering what ideas people could offer for a simple HTML viewer I could plug into a Tkinter/Pmw Application. Does anyone know of something simple, yet robust? > > Hi Christopher, pysol has a (very basic) html viewer to display its documentation (http://www.pysol.org/). pysol is GPL'd, so if their html widget is good enough for you it's probably no problem for you to use it. It can display headers, horizontal lines, ordered and bulleted lists and (gif) images, but no advanced stuff like tables or frames. I've used it for my own documentation and it works very well. Michael From Cameron at Phaseit.net Mon Jan 30 19:17:02 2006 From: Cameron at Phaseit.net (Cameron Laird) Date: Mon, 30 Jan 2006 18:17:02 +0000 Subject: [Tkinter-discuss] HTML Viewer In-Reply-To: References: <410-22006152711841953@earthlink.net> <20060127204308.GA14040@lairds.us> Message-ID: <20060130181702.GB3664@lairds.us> On Fri, Jan 27, 2006 at 01:51:51PM -0700, Stewart Midwinter wrote: . . . > Cameron, I see that mention is made of lwidgets, a new set of widgets > built from other widgets. None of those have been added to Tkinter's > set of widgets, have they? > > Off the top of your head, do you know of a good tutorial page for > someone wanting to create Tkinter wrappers for Tk widgets? . . . I know of no one who has systematically exposed Iwidgets in Tkinter. I was sure one of had us written a page on exactly the subject of wrapping Tk widgets for Tkinter. I can't find it now, to my chagrin. I'll return to this subject later in the week. From gilcneth at earthlink.net Tue Jan 31 03:32:52 2006 From: gilcneth at earthlink.net (gilcneth at earthlink.net) Date: Mon, 30 Jan 2006 21:32:52 -0500 Subject: [Tkinter-discuss] HTML Viewer Message-ID: <410-22006123123252234@earthlink.net> Michael, That's great, thank you! I'll check it out. It may be all I need, if I clip out all the unnecessary HTML from the pages or (if time allows) enhance the viewer a little. The pages I want to view are (relatively) basic, since they contain few images and not a lot of 'fancy formatting'. Thank you again and best regards, Chris Nethery > [Original Message] > From: Michael Lange > To: > Date: 1/30/2006 7:58:47 AM > Subject: Re: [Tkinter-discuss] HTML Viewer > > On Thu, 26 Jan 2006 20:18:41 -0500 > "gilcneth at earthlink.net" wrote: > > > I am wondering what ideas people could offer for a simple HTML viewer I could plug into a Tkinter/Pmw Application. Does anyone know of something simple, yet robust? > > > > > > Hi Christopher, > > pysol has a (very basic) html viewer to display its documentation (http://www.pysol.org/). > pysol is GPL'd, so if their html widget is good enough for you it's probably no problem for you to > use it. > It can display headers, horizontal lines, ordered and bulleted lists and (gif) images, but no advanced stuff like > tables or frames. I've used it for my own documentation and it works very well. > > Michael > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss From camfarnell at cogeco.ca Tue Jan 31 06:52:25 2006 From: camfarnell at cogeco.ca (Cam) Date: Tue, 31 Jan 2006 00:52:25 -0500 Subject: [Tkinter-discuss] Catching exceptions Message-ID: <43DEFB19.6000901@cogeco.ca> ProgramA (a Tkinter application) contains this code snippet: try: execfile('programB',{}) except: Where it runs programB. ProgramA would like to catch and handle any otherwise uncaught exceptions in ProgramB. If programB is NOT a Tkinter application then ProgramA does indeed catch and handle exceptions that occur in programB. However, if ProgramB is a Tkinter application then virtually all the action takes place inside callbacks and any exceptions in those callbacks are caught and handled by Tkinter, thus never getting to exception handler in ProgramA. Is there any way to tell Tkinter not to handle exceptions in callbacks so that on an exception in a callback programB would grind to a halt and the exception handler in ProgramA would take over? Or would this violate some fundamental principle of how Tkinter works? Any knowledgable advice on this would be *greatly* appreciated. Cam Farnell If you are wondering what I'm up to, ProgramA is an (under construction) development environment which has produced ProgramB which we would now like to run. If execution of ProgramB goes badly we would like to show a traceback and then be able to take you to the offending line of code. But if Tkinter catches and hides the error, that's hard to do. From lists at nabble.com Tue Jan 31 12:40:47 2006 From: lists at nabble.com (Blujacker (sent by Nabble.com)) Date: Tue, 31 Jan 2006 03:40:47 -0800 (PST) Subject: [Tkinter-discuss] Please help Tkinter Message-ID: <2678244.post@talk.nabble.com> > I am not english.I am from czech and mine english is very bad but i need help please.on page:http://poradna.programujte.com/viewtopic.php?t=973, there is my programm.If you run it and click on "rozvrh"and the you click on "prumer", you will see two windows.How to destroy the old window??I have used function Toplevel() for create a new window.Thanks for help! -- View this message in context: http://www.nabble.com/Please-help-Tkinter-t1032248.html#a2678244 Sent from the Python - tkinter-discuss forum at Nabble.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/tkinter-discuss/attachments/20060131/dbdf4387/attachment.htm From jepler at unpythonic.net Tue Jan 31 14:19:18 2006 From: jepler at unpythonic.net (jepler at unpythonic.net) Date: Tue, 31 Jan 2006 07:19:18 -0600 Subject: [Tkinter-discuss] Catching exceptions In-Reply-To: <43DEFB19.6000901@cogeco.ca> References: <43DEFB19.6000901@cogeco.ca> Message-ID: <20060131131917.GB1813@unpythonic.net> Here's a snippet I have laying around. It doesn't exactly do what you ask, but maybe it's a starting point. You might see what the cited sf tracker item is about as well. # Print Tk errors to stdout. python.org/sf/639266 import Tkinter OldTk = Tkinter.Tk class Tk(OldTk): def __init__(self, *args, **kw): OldTk.__init__(self, *args, **kw) self.tk.createcommand('tkerror', self.tkerror) def tkerror(self, arg): print "TCL error in asynchronous code:" print self.tk.call("set", "errorInfo") Tkinter.Tk = Tk From lists at nabble.com Tue Jan 31 15:34:38 2006 From: lists at nabble.com (Blujacker (sent by Nabble.com)) Date: Tue, 31 Jan 2006 06:34:38 -0800 (PST) Subject: [Tkinter-discuss] I am aking again Message-ID: <2680779.post@talk.nabble.com> I am here again.I am sure you can help me.I need any function like destroy which can delete window.The programm you can see on http://poradna.programujte.com/viewtopic.php?t=973 If you run in, You will see a menu.If you open "rozrh hodin" and then you open "prumer" you will see 3 windows.How to delete 2 old windows?I would like see all timees only one window: Here is the programm: from Tkinter import * import sys okno=Tk() zaznam=0.000 man=0.000 def znic(): okno.destroy def prumery(): top=Toplevel() okno.destroy def dement1(): global zaznam,man,dement1 zaznam=zaznam+1.000 man=man+1.000 def dement2(): global zaznam,man,dement2 zaznam=zaznam+2.000 man=man+1.00 def dement3(): global zaznam,man,dement3 zaznam=zaznam+3.000 man=man+1.000 def dement4(): global zaznam,man,dement4 zaznam=zaznam+4.000 man=man+1.000 def dement5(): global zaznam,man,dement5 zaznam=zaznam+5.000 man=man+1.000 def money(): global zaznam,man,money prumer1.configure(text=zaznam/man) prvni=Button(top, text="1",command=dement1) prvni.grid(row=1, column=0) druhy=Button(top, text="2",command=dement2) druhy.grid(row=2, column=0) treti=Button(top, text="3",command=dement3) treti.grid(row=3,column=0) ctvrty=Button(top, text="4",command=dement4) ctvrty.grid(row=4,column=0) paty=Button(top, text="5",command=dement5) paty.grid(row=5,column=0) prumer=Button(top, text="Prumer",command=money) prumer.grid(row=1, column=2) prumer1=Label(top, text="Prumer:") prumer1.grid(row=4, column=2) menubar = Menu(top) # create a pulldown menu, and add it to the menu bar filemenu = Menu(menubar, tearoff=0) filemenu.add_command(label="Rozvrh", command=(veci)) filemenu.add_separator() menubar.add_cascade(label="Rozvrh hodin", menu=filemenu) # create more pulldown menus editmenu = Menu(menubar, tearoff=0) editmenu.add_command(label="Prumer", command=prumery) menubar.add_cascade(label="Prumer", menu=editmenu) helpmenu = Menu(menubar, tearoff=0) helpmenu.add_command(label="Exit", command=okno.destroy) helpmenu.add_command(label="save", command=Save) menubar.add_cascade(label="Exit", menu=helpmenu) top.config(menu=menubar) def veci(): okno.destroy top=Toplevel() def TV1(): global tv1,TV1 free1.configure(text="Telesna vychova;Peter Kuba;Mala telocvicna") def M1(): global m1,M1 free1.configure(text="Matematika,Hana Rosolova;Ucebna c.37") def F1(): global f1, F1 free1.configure(text="Fyzika, Hana Rosolova;Ucebna c.42") def C1(): global c1, C1 free1.configure(text="Cesky jazyk-Literatura;Lenka Necasova;Ucebna c.16") def D1(): global d1,D1 free1.configure(text="Dejepis;Jan Kvirenc;Ucebna c.35") def prm(): global zaznam zaznam=0.000 man=0.000 def A1(): global a1 free1.configure(text="Anglicky jazyk;Adam Kosik;Ucebna c.41") def V(): global v1,v2 free1.configure(text="Vytvarna Vychova;Cech Matej;Ucebna c.53") def N1(): global n1 free1.configure(text="Nemecky jazyk;Pacholikova Marie;Ucebna c.42") def M2(): global m2 free1.configure(text="Matematika;Hana Rosolova;Ucebna c.45") def CH1(): global c1 free1.configure(text="Chemie;Buth Stanislav;Ucebna c.24") def Z1(): global z1 free1.configure(text="Zemepis;Jitka Breitschneiderova;Ucebna c.14") def C2(): global c2 free1.configure(text="Cesky jazyk;Lenka Necasova;Ucebna c.04") def B1(): global b1 free1.configure(text="Biologie;Jarmila Ekschlagerova;Ucebna c.32") def OV1(): global ov1 free1.configure(text="Obcanska vychova;Kadlec Frantisek;Ucebna c.11") def N2(): global n2 free1.configure(text="Nemecky jazyk;Pacholikova Marie;Ucebna c.42") def D2(): global d2 free1.configure(text="Dejepis;Jan Kvirenc;Ucebna c.23") def M3(): global m3 free1.configure(text="Matematika;Hana Rosolova;Ucebna c.26") def TV2(): global tv2 free1.configure(text="Telesna vychova;Kuba Peter;Posilovna") def F2(): global f2 free1.configure(text="Fyzika;Hana Rosolova;Ucebna c.42") def C3(): global c3 free1.configure(text="Cesky jazyk;Lenka Necasova;Ucebna c.04") def Z2(): global z2 free1.configure(text="Zemepis;Jitka Breitschneiderova;Ucebna c.13") def B2(): global b2 free1.configure(text="Biologie;Jarmila Ekschlagerova;Ucebna c.34") def A2(): global a2 free1.configure(text="Anglicky jazyk;Adam Kosik;Ucebna c.53") def I(): i1,i2 free1.configure(text="Informatika;*** Drbohlavova;Ucebna c.02") def A3(): global a3 free1.configure(text="Anglicky jazyk;Adam Kosik;Ucebna c.46") def N3(): global n3 free1.configure(text="Nemecky jazyk;Pacholikova Marie;Ucebna c.36") def H(): global h free1.configure(text="Hudebni vychova;Duskova Marie;Ucebna c.54") def CH2(): global ch2 free1.configure(text="Chemie;Buth Stanislav;Ucebna c.26") def M4(): global m4 free1.configure(text="Matematika;Hana Rosolova;Ucebna c.41") def C4(): global c4 free1.configure(text="Cesky jazyk;Lenka Necasova;Ucebna c.12") def TV3(): global tv3 free1.configure(text="Telesna vychova;Kuba Peter;Velka telocvicna") def obed(): global o1 free1.configure(text="Pausa na obed.") pondeli=Label(top, text="Pondeli", background='white', foreground='red',activeforeground='yellow') pondeli.grid(row=1, column=4) utery=Label(top, text="Utery", background='white', foreground='red') utery.grid(row=2, column=4) streda=Label(top, text="Streda", background='white', foreground='red') streda.grid(row=3, column=4) ctvrtek=Label(top, text="Ctvrtek", background='white', foreground='red') ctvrtek.grid(row=4, column=4) patek=Label(top, text="Patek", background='white', foreground='red') patek.grid(row=5, column=4) hod1=Label(top, text="1.Hodina", background='white', foreground='red') hod1.grid(row=0, column=5) hod2=Label(top , text="2.Hodina", background='white', foreground='red') hod2.grid(row=0, column=6) hod3=Label(top, text="3.Hodina", background='white', foreground='red') hod3.grid(row=0, column=7) hod4=Label(top, text="4.Hodina", background='white', foreground='red') hod4.grid(row=0, column=8) hod5=Label(top, text="5.Hodina", background='white', foreground='red') hod5.grid(row=0, column=9) hod6=Label(top, text="6.Hodina", background='white', foreground='red') hod6.grid(row=0,column=10) hod7=Label(top, text="7.Hodina", background='white', foreground='red') hod7.grid(row=0, column=11) hod8=Label(top, text="8.Hodina", background='white', foreground='red') hod8.grid(row=0, column=12) hod9=Label(top, text="9.Hodina", background='white', foreground='red') hod9.grid(row=0,column=13) hod10=Label(top, text="10.Hodina", background='white', foreground='red') hod10.grid(row=0, column=14) tv1=Button(top, text="Tv", command=TV1, background='pink',activebackground='yellow') tv1.grid(row=1, column=5) m1=Button(top, text="M", command=M1, background='red') m1.grid(row=1,column=6) f1=Button(top, text="F", command=F1, background='brown') f1.grid(row=1, column=7) c1=Button(top, text="Cj", command=C1, background='blue') c1.grid(row=1, column=8) d1=Button(top, text="D" , command=D1, background='Black', foreground='white') d1.grid(row=1, column=9) a1=Button(top, text="Aj", command=A1, background='green') a1.grid(row=1, column=10) v1=Button(top, text="Vv", command=V, foreground='blue') v1.grid(row=1, column=12) v2=Button(top, text="Vv", command=V, foreground='blue') v2.grid(row=1, column=13) n1=Button(top, text="Nj", command=N1, background='yellow') n1.grid(row=2, column=5) m2=Button(top, text="M", command=M2, background='red') m2.grid(row=2, column=6) ch1=Button(top, text="Ch", command=CH1, background='orange') ch1.grid(row=2, column=7) z1=Button(top, text="Z", command=Z1, background='grey') z1.grid(row=2, column=8) c2=Button(top, text="Cj", command=C2, background='blue') c2.grid(row=2, column=9) b1=Button(top, text="B", command=B1, foreground='red') b1.grid(row=2, column=10) ov1=Button(top, text="Ov", command=OV1, foreground='green') ov1.grid(row=3, column=5) n2=Button(top, text="Nj", command=N2, background='yellow') n2.grid(row=3, column=6) d2=Button(top, text="D", command=D2, background='Black', foreground='white') d2.grid(row=3, column=7) m3=Button(top, text="M", command=M3, background='red') m3.grid(row=3, column=8) tv2=Button(top, text="Tv", command=TV2, background='pink') tv2.grid(row=3,column=10) f2=Button(top, text="F", command=F2, background='brown') f2.grid(row=3, column=11) c3=Button(top, text="Cj", command=C3, background='blue') c3.grid(row=4, column=7) z2=Button(top, text="Z", command=Z2, background='grey') z2.grid(row=4, column=8) b2=Button(top, text="B", command=B2, foreground='red') b2.grid(row=4, column=9) a2=Button(top, text="Aj", command=A2, background='green') a2.grid(row=4, column=11) i1=Button(top, text="In", command=I, foreground='orange') i1.grid(row=4, column=12) i2=Button(top, text="In", command=I, foreground='orange') i2.grid(row=4,column=13) a3=Button(top, text="Aj", command=A3, background='green') a3.grid(row=5,column=5) n3=Button(top, text="Nj", command=N3, background='yellow') n3.grid(row=5,column=6) h=Button(top, text="Hv", command=H, foreground='yellow') h.grid(row=5, column=7) ch2=Button(top, text="Ch", command=CH2, background='orange') ch2.grid(row=5, column=8) m4=Button(top, text="M", command=M4, background='red') m4.grid(row=5, column=9) c4=Button(top, text="Cj", command=C3, background='blue') c4.grid(row=5, column=10) tv3=Button(top, text="Tv", command=TV3, background='pink') tv3.grid(row=5, column=12) def hello(): print "hello!" menubar = Menu(top) # create a pulldown menu, and add it to the menu bar filemenu = Menu(menubar, tearoff=0) filemenu.add_command(label="Rozvrh", command=veci) filemenu.add_separator() menubar.add_cascade(label="Rozvrh hodin", menu=filemenu) # create more pulldown menus editmenu = Menu(menubar, tearoff=0) editmenu.add_command(label="Prumer", command=prumery) menubar.add_cascade(label="Prumer", menu=editmenu) helpmenu = Menu(menubar, tearoff=0) helpmenu.add_command(label="Exit", command=okno.destroy) helpmenu.add_command(label="save", command=Save) menubar.add_cascade(label="Exit", menu=helpmenu) top.config(menu=menubar) #fereeesdfdsfdsf free=Label(top, text="Podrobnosti:") free.grid(row=1, column=16) free1=Label(top, text="") free1.grid(row=2, column=16) def Save(self): "Ulozeni dokumentu" soubor = file(self.filename,'w') soubor.write(self.text.get("1.0",END).encode(KODOVANI)) soubor.close() def hello(): print "hello!" menubar = Menu(okno) # create a pulldown menu, and add it to the menu bar filemenu = Menu(menubar, tearoff=0) filemenu.add_command(label="Rozvrh", command=(veci)) filemenu.add_separator() menubar.add_cascade(label="Rozvrh hodin", menu=filemenu) # create more pulldown menus editmenu = Menu(menubar, tearoff=0) editmenu.add_command(label="Prumer", command=prumery) menubar.add_cascade(label="Prumer", menu=editmenu) helpmenu = Menu(menubar, tearoff=0) helpmenu.add_command(label="Exit", command=okno.destroy) helpmenu.add_command(label="save", command=Save) menubar.add_cascade(label="Exit", menu=helpmenu) okno.config(menu=menubar) mainloop() -- View this message in context: http://www.nabble.com/I-am-aking-again-t1033125.html#a2680779 Sent from the Python - tkinter-discuss forum at Nabble.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/tkinter-discuss/attachments/20060131/f1d6d4da/attachment-0001.html From jepler at unpythonic.net Tue Jan 31 17:53:06 2006 From: jepler at unpythonic.net (jepler at unpythonic.net) Date: Tue, 31 Jan 2006 10:53:06 -0600 Subject: [Tkinter-discuss] I am aking again In-Reply-To: <2680779.post@talk.nabble.com> References: <2680779.post@talk.nabble.com> Message-ID: <20060131165306.GA18281@unpythonic.net> On Tue, Jan 31, 2006 at 06:34:38AM -0800, Blujacker (sent by Nabble.com) wrote: > def znic(): > okno.destroy In Python, you must write 'f()' to call the function f with no arguments. Perhaps you meant to write def znic(): okno.destroy() destroy() is the correct method to call to get rid of a widget. Jeff