Enhanced Listbox
My apologies if this question has been asked an answered. I am looking for a tkinter grid control or enhanced listbox that can act as a "receipt" for a cash register program. I would like the widget to contain a visible grid of columns and rows. I've tried binding multiple listboxes to a scrollbar. This works OK, but I am missing the vertical lines dividing each row and I can't seem to figure out how to set the height (or vertical margin) of each row in the listbox(es). If I could do these things my current implementation might be OK. Or, I could just use a pre-packaged solution, if I coud find one. Any help is appreciated. -- http://mail.python.org/mailman/listinfo/python-list
Re: Enhanced Listbox
Thanks for your reply. I have done this. It certainly helps. My biggest concern right now is the vertical space between the fonts in each row. I need more than the default and I'm not sure on how to go about achieving this. Also, the vertical lines between each row would be nice. H J van Rooyen wrote: > "drodrig" <[EMAIL PROTECTED]> > > > | My apologies if this question has been asked an answered. > | > | I am looking for a tkinter grid control or enhanced listbox that can > | act as a "receipt" for a cash register program. I would like the widget > | to contain a visible grid of columns and rows. I've tried binding > | multiple listboxes to a scrollbar. This works OK, but I am missing the > | vertical lines dividing each row and I can't seem to figure out how to > | set the height (or vertical margin) of each row in the listbox(es). If > | I could do these things my current implementation might be OK. Or, I > | could just use a pre-packaged solution, if I coud find one. > | > | Any help is appreciated. > | > - you could try making your columns different background colours if this is > acceptable... > > - Hendrik -- http://mail.python.org/mailman/listinfo/python-list
Kill process based on window name (win32)
Hi. I am trying to close/kill all processes that show visible windows on Windows XP. So far I've created a script that uses win32gui.EnumWindows to iterate through all windows, check for which windows are visible, then send a WM_CLOSE message to the window to request that it closes. Of course, not all apps want to close nicely. At this point I need to use something like TerminateProcess to kill the app, but how do I find the process id (hopefully based on the window id). Thanks for any help. -- http://mail.python.org/mailman/listinfo/python-list
Re: Kill process based on window name (win32)
Thank you Roger. Your advice did the trick. For anyone interested, the basic code to terminate a process (politely) would be something like this (hwnd is retrieved using win32gui.EnumerateWindows): # Get the window's process id's t, p = win32process.GetWindowThreadProcessId(hwnd) # Ask window nicely to close win32gui.PostMessage(hwnd, win32con.WM_CLOSE, 0, 0) # Allow some time for app to close time.sleep(10) # If app didn't close, force close try: handle = win32api.OpenProcess(win32con.PROCESS_TERMINATE, 0, p) if handle: win32api.TerminateProcess(handle,0) win32api.CloseHandle(handle) except: pass: Roger Upole wrote: > drodrig wrote: > > Hi. > > > > I am trying to close/kill all processes that show visible windows on > > Windows XP. So far I've created a script that uses win32gui.EnumWindows > > to iterate through all windows, check for which windows are visible, > > then send a WM_CLOSE message to the window to request that it closes. > > Of course, not all apps want to close nicely. At this point I need to > > use something like TerminateProcess to kill the app, but how do I find > > the process id (hopefully based on the window id). > > > > Thanks for any help. > > > > win32process.GetWindowThreadProcessId should do the trick. > >Roger -- http://mail.python.org/mailman/listinfo/python-list
Re: Kill process based on window name (win32)
I am running the program mentioned below as an NT service on a terminal server. The service listens on a UDP port for any of a series of commands. In this case, the command "closeApps " will notify the service to close all the open apps for user (). So while the code below works great for a standalone app, it fails as a service because the window handles of each user are not retrievable (I should say I don't know how to retrieve them). Is this even possible? I looked at some of the Windows API calls but nothing stuck out. Suggestions? drodrig wrote: > Thank you Roger. Your advice did the trick. For anyone interested, the > basic code to terminate a process (politely) would be something like > this (hwnd is retrieved using win32gui.EnumerateWindows): > > # Get the window's process id's > t, p = win32process.GetWindowThreadProcessId(hwnd) > # Ask window nicely to close > win32gui.PostMessage(hwnd, win32con.WM_CLOSE, 0, 0) > # Allow some time for app to close > time.sleep(10) > # If app didn't close, force close > try: > handle = win32api.OpenProcess(win32con.PROCESS_TERMINATE, 0, p) > if handle: > win32api.TerminateProcess(handle,0) > win32api.CloseHandle(handle) > except: > pass: > > Roger Upole wrote: > > drodrig wrote: > > > Hi. > > > > > > I am trying to close/kill all processes that show visible windows on > > > Windows XP. So far I've created a script that uses win32gui.EnumWindows > > > to iterate through all windows, check for which windows are visible, > > > then send a WM_CLOSE message to the window to request that it closes. > > > Of course, not all apps want to close nicely. At this point I need to > > > use something like TerminateProcess to kill the app, but how do I find > > > the process id (hopefully based on the window id). > > > > > > Thanks for any help. > > > > > > > win32process.GetWindowThreadProcessId should do the trick. > > > >Roger -- http://mail.python.org/mailman/listinfo/python-list
Copying a file with a question mark in it's name in Windows
A python script I use to backup files on a Windows 2003 server
occasionally fails to retrieve the size of a file with a question mark
in the name. The exception I get is "OSError #123 The filename,
directory name, or volume label syntax is incorrect". I realize that
technically a question mark in the name of a file on Windows is
illegal, but nevertheless these files exist on the file system. It
seems that they are created by Office 2007 Word, for the most part.
The line that fails is:
os.path.getsize(source)
Where source is the full path to the file with the question mark in
it's name.
Any idea how to retrieve the file's size? Also, I imagine that after I
overcome this hurdle, I'll need help finding a way to copy the file
(assuming copy2() doesn't work). I've tried escaping the question mark
("\\?"). Same result.
Although I could use the Windows "dir" command, parsing the results to
find the size of the file then use the Windows "copy" command, I'd
rather stay away from this type of solution.
Any help is appreciated!
--
http://mail.python.org/mailman/listinfo/python-list
[SOLVED]: Copying a file with a question mark in it's name in Windows
On Aug 12, 9:16 am, Aleksey wrote: > On 12 авг, 18:49,drodrig wrote: > > > A python script I use to backup files on a Windows 2003 server > > occasionally fails to retrieve the size of a file with a question mark > > in the name. The exception I get is "OSError #123 The filename, > > directory name, or volume label syntax is incorrect". I realize that > > technically a question mark in the name of a file on Windows is > > illegal, but nevertheless these files exist on the file system. It > > seems that they are created by Office 2007 Word, for the most part. (Sorry for the late reply) Thank you. The questions marks are indeed placeholders for unprintable characters. The glob module did the trick. > > If "?" is a placeholder for an unprintable character you can try view > real file name in IDLE: > > import glob > print glob.glob(u'e:/full/path/to/file?') > > In path to file you must instead question use wild "?". > Will be printed all like files. > > - > Under Windows I too have similar problem: windows sometimes (from any > programs - e.g. Firefox) save files with wrong names, but later > do not manipulate with it. -- http://mail.python.org/mailman/listinfo/python-list
