Re: [Tutor] adjust key bindings

2006-11-27 Thread John CORRY
# Ctrl-S > 0x14: 'tree', # Ctrl-T > ord('0'): 'bookmark_0', > ord('1'): 'bookmark_1', > ... > > > with such a keytable I am able to bind different 'def's to every > existing

[Tutor] adjust key bindings

2006-11-26 Thread John CORRY
t;z" key press and assign a "Down" key press but I can't get the "Down" key press to register on the Treeview in the GUI. Any thoughts greatly appreciated. Thanks, John. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf

[Tutor] Dates

2006-09-10 Thread John CORRY
Bob and Alan, Thanks for the help. I have gone with the following code and it works! a = "date(%i,%i,%i)" % (2006,01,31) b = "date(%i,%i,%i)" % (2006,12,31) sql = 'SELECT * FROM times where rt_weekst >= %s and rt_weekst <= %s and rt_type = "%s" ' % (a,b,"R",) db = mx.ODBC.Windows.DriverConnect('

[Tutor] Dates

2006-09-10 Thread John CORRY
Alan, Thanks for the help. I have converted the dates to strings but I get the same error. Please see the updated code below, is this what you meant by converting the dates to strings? import mx.ODBC import mx.ODBC.Windows import mx.DateTime import datetime a = datetime.date(2006,01,31) b = dat

[Tutor] Dates

2006-09-09 Thread John CORRY
Hi All, I am using the code below to select items from a visual foxpro database where the dates are between the 31/01/2006 and 31/12/2006. The good news is that the code below works. However, I want to make the from and to dates variable. I want to change the range depending on user input. I c

Re: [Tutor] [pygtk] key_press_event

2006-08-13 Thread John CORRY
Sandro, That's exactly what I need. Thanks, John. > def callback3(self,data,widget): > > input = data.get_text() > print input > data.set_text("test") If you don't return True, default callback will be called that insert the 'a'. I have something like t

[Tutor] key_press_event

2006-08-13 Thread John CORRY
Hi, I'm using Python 2.4, pygtk and Glade2. I have a few text entries. I am trying to put validation on the text entry boxes. I am trying to catch the key_press_event, check the key that has been pressed and either allow it or put back the old text. The code is below with the output after it.

[Tutor] loops to assign variables

2006-07-22 Thread John CORRY
Hi,   I am refactoring my code.  I am trying to reduce the amount of lines by using more loops.  I tend to use copy and paste a lot instead of writing a loop to do the work.   For example, I have 30 textentry boxes numbered from entry20 to entry50.  I have used the following code to ass

[Tutor] Good teamwork!

2006-07-21 Thread John CORRY
George/Kent,   Thanks guys for the pointers.   Kent – The gtk-entry-set-alignment() works a treat.   George – I like the look of the sample code you posted.  At the moment it doesn’t give me exactly what I need but I am still playing with it.  There may be another question on this lat

[Tutor] Help me make it look pretty!

2006-07-20 Thread John CORRY
Good evening all.   I am writing a program using python 2.4, glade 2 and pygtk.  It takes input from the user using textentry boxes.  The input should be a number.  When the user keys the data in, it automatically left justifies.  The function below, takes the input for four boxes and rig

Re: [Tutor] Delete directories recursively

2006-06-16 Thread John Corry
Amresh,   I had this problem a few months back.  I approached it backwards.  Maybe not the right way to do it.  I removed all the files and directories and then had my exception handle the file if it was read only.  The exception  handler changes the file from read-only to not read only and

[Tutor] Treeview

2006-05-14 Thread John CORRY
Hi,   I have managed to find the solution to my problem.   I have defined iter as   Iter = model.get_iter(combo3)   The code now works.  I will show it below for completeness:   combo3 = self.wTree.get_widget("treeview1")     model=gtk.TreeStore(gobject.TYPE_STRING,gobject.

[Tutor] Problems with Treeview

2006-05-13 Thread John CORRY
Hi,   I am having problems selecting a row in treeview.  I am using Pythoncard, Glade 2 and Python 2.4.   I am using the following code:-   combo3 = self.wTree.get_widget("treeview1") model=gtk.TreeStore(gobject.TYPE_STRING,gobject.TYPE_STRING,gobject.TYPE_STRING,gobject.TYPE_STRING,

Re: [Tutor] Button Signals

2006-05-07 Thread John CORRY
ignal handler. Your code needs the following:     self. callback_id1 = process.connect("clicked", self.callback1, start_date, process)   def callback1(self,data,start_date,process ):     process.disconnect(self.callback_id1)           On 5/7/06, John CORRY <

[Tutor] Button Signals

2006-05-07 Thread John CORRY
Hi,   I am having difficulty with using signal handlers.  I am using Glade 2 and Pygtk.  My editor is Pythoncard.  The following code connects to button one and calls a function which hides button one.     self.wTree = gtk.glade.XML ("phonelog.glade", "window1")     dic={"on_window

[Tutor] Stumbled onto the answer!

2006-05-06 Thread John CORRY
Hi,   I have managed to “fix” my two combo box problem.  I have used the following code:-   self.wTree = gtk.glade.XML ("phonelog.glade", "window1")     dic={"on_window1_destroy" : self.quit, }     self.wTree.signal_autoconnect (dic)         combo1 = self.wTree.get_

[Tutor] 2 Combo Boxes! What was I thinking?

2006-05-06 Thread John CORRY
  Hi,   I have set up a GUI which has amongst other widgets two combo boxes.  I am using:   PythonCard version: 0.8.1 wxPython version: 2.6.1.0 Python version: 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] Platform: win32 Glade 2   I started by setting up combobo

[Tutor] 2 Combo Boxes! What was I thinking?

2006-05-04 Thread John CORRY
Hi,   I have set up a GUI which has amongst other widgets two combo boxes.  I am using:   PythonCard version: 0.8.1 wxPython version: 2.6.1.0 Python version: 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] Platform: win32 Glade 2   I started by setting up comboboxen

[Tutor] My Name is John and I copy and paste

2006-04-18 Thread John CORRY
Hi,   Thanks for all the help so far on my database questions.  I have now developed a program that reads in info from a csv file and updates already existing records in my database.  I have enclosed the code below.  The good news is that it is working.  However, I used copy and paste and

[Tutor] School Boy Error - Update

2006-04-16 Thread John CORRY
Hi,   I have taken on board the advice in relation to the cvs module and setting the list to a tuple.  I am now using the following code and getting a different error.  I think it is a small step forward?   import string, re path = "c:/test/import.csv" listy = [] import csv reader =

[Tutor] School Boy Error

2006-04-16 Thread John CORRY
Bri,   Print stat gives   Insert into cost_grid values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,) Tracebac

[Tutor] School Boy error

2006-04-16 Thread John CORRY
Hi,   I couldn’t sleep last night with all the code running though my head.  Counting sheep didn’t work as I kept wanting to turn them into a loop!   listy[-1]   Outputs the following:-   ['432', 'TM BLIND', 'RO', 'PF1', 'Plain Finish Range One', '304.8', '', '45.7', '80', '90', '0'

[Tutor] School Boy Error

2006-04-15 Thread John CORRY
Thanks Brian for the help on the last one.  I couldn’t see the wood for the trees.  I have a tougher one for you.   I am reading in a CSV file.  Each line represents a line that I want to upload into my database.  I am trying to upload the first line in the file to get myself started.  Th

[Tutor] Didn't take long to hit my next wall!

2006-04-15 Thread John CORRY
Hi,   I am having problems amending records in my database.   If I use the following code my database is updated fine.   c = '"PF1"' b = 91.4 a = 85.00 import mx.ODBC import mx.ODBC.Windows db = mx.ODBC.Windows.DriverConnect('DSN=vfp') c = db.cursor() c.execute('UPDATE cost_gri

[Tutor] Good Hustle Hit the Showers!

2006-04-15 Thread John Corry
] odbc On Sat, 2006-04-15 at 16:03 +0100, John Corry wrote: > Kent, > > I am not sure what you mean. I am feeling about in the dark on this > subject. > > Do you have an example? You should have a Control Panel Application for configuring ODBC data sources. The program using

Re: [Tutor] odbc

2006-04-15 Thread John Corry
this what I need to log onto with python first before I access the database file? Regards, John. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Kent Johnson Sent: 15 April 2006 15:40 Cc: tutor@python.org Subject: Re: [Tutor] odbc John CORRY wrote: >

[Tutor] odbc

2006-04-15 Thread John CORRY
Hi,   I have just run the test package within mxODBC.  I get the following result.   mx.ODBC Test Suite   Subpackage Name [Windows]:  

Re: [Tutor] Difficulty connecting with odbc drivers

2006-04-15 Thread John Corry
important !). So, you've got DSN lowercase... On 4/16/06, John CORRY <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > I have downloaded the mxodbc product. I am using windows xp, python 2.4 and > I am trying to log onto a visual foxpro database file. I have d

[Tutor] Difficulty connecting with odbc drivers

2006-04-15 Thread John CORRY
Hi,   I have downloaded the mxodbc product.  I am using windows xp, python 2.4 and I am trying to log onto a visual foxpro database file.  I have downloaded the visual foxpro driver.  I use the following code:   import mx.ODBC import mx.ODBC.Windows db = mx.ODBC.Windows.DriverConnect(

[Tutor] Difficulty connecting with odbc drivers

2006-04-15 Thread John CORRY
Hi,   I have downloaded the mxodbc product.  I am using windows xp, python 2.4 and I am trying to log onto a visual foxpro database file.  I have downloaded the visual foxpro driver.  I use the following code:   import mx.ODBC import mx.ODBC.Windows db = mx.ODBC.Windows.DriverConnect(

[Tutor] Databases

2006-04-13 Thread John Corry
Hi, I have some database files that are written in visual foxpro. I want to be able to access them, read them and amend them. Can I do this with python? Are there any good links or websites that would specifically deal with interrogating visual foxpro databases with Python? I have limited know

[Tutor] Space the final frontier

2006-04-05 Thread John Corry
Dear All, Thanks for the prompt replies. I have now processed my file with 999 lines and it took seconds. It was beautiful. Your advice was spot on. I have enclosed the code that I ended up with. Instead of appending it to a list, I just wrote it to another file in the corrected format. file

[Tutor] Space the final frontier!

2006-04-04 Thread John Corry
Dear All, I am having difficulty removing white spaces from my file. The file is 999 lines long and looks like the sample below: 001, new field,dial= 028 90 79 0154, dial= 002, borfiled, dial= 02890 618521, dial= 003, newcomp, dial=02890419689, dial= The program, I am using to import the file d

[Tutor] Gadfly Database Problems

2006-02-14 Thread John Corry
Hi, I have a python program that accesses glade and a gadfly database. The program works fine on my computer but I want to compile it so that I can put it on other computers without having to install everything that my computer has. I have had a go at compiling it using py2exe. I have used the

[Tutor] Landscape Printing

2006-01-08 Thread John Corry
Hi, My text file is printing out in portrait. Is there any instruction that I can use so that notepad prints it in landscape? Thanks, John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Nearly there

2006-01-07 Thread John Corry
2006 00:24 To: tutor@python.org Subject: Re: [Tutor] Nearly there This is itching at me, too. On Fri, 6 Jan 2006, John Corry wrote: > Can anyone understand or tell me why this works but the following code does > not:- > > import win32api > filename = "testprint.txt" &

[Tutor] Nearly there

2006-01-06 Thread John Corry
Thanks for all the feedback and help. The good news is that I have managed to get my windows 98 SE machine to print a text file using the follwing code:- import tempfile import win32api filename = tempfile.mktemp (".txt") open (filename, "w").write ("This is a test") win32api.ShellExecute ( 0,

Re: [Tutor] Further help needed!

2006-01-05 Thread John Corry
05/01/06, John Corry <[EMAIL PROTECTED]> wrote: > This code works on windows XP + Windows 2000. However it does not work on > windows 98SE. I have tried this code on 3 seperate machines with windows > 98SE. They all come up with the same error: > > File > "C:\Python24

[Tutor] Further help needed!

2006-01-04 Thread John Corry
I am using the following code to send a text file to the printer:- import win32api filename = "testprint.txt" fileobj=open (filename, "w") fileobj.write ("This is a test") fileobj.close() win32api.ShellExecute ( 0, "print", filename, None, ".", 0 ) This code works on windows XP + Wind

[Tutor] Printing error on Win 98SE

2006-01-02 Thread John Corry
Hi + Happy New Year, With help from several people from the mailing list I have been able to print out text files on my windows XP machine. I have tried using the same program on my windows 98SE machine and I get the following error: PythonWin 2.4.2 (#67, Oct 30 2005, 16:11:18) [MSC v.1310 32 bi

Re: [Tutor] Printing

2005-12-26 Thread John Corry
;, 'The system cannot find the file specified .') I have played about with it and saved it in various places but I can't get it to work. Any suggestions? Do I need to import other modules? Do I need to use Pythonwin? Thanks, John. -Original Message- From: [EMAIL PROT

[Tutor] Printing

2005-12-24 Thread John Corry
Hi + Season's Greetings! I have put together a program that queries and modifies a Gadfly database. I have captured my output. I now want to print it to paper. I have written the output to a text file. I have searched the tutor mailing list and used the mailing list advice to get my data into