button binding isn't triggering event like it's supposed to

2007-10-09 Thread mridula
hi.

i am trying to learn event binding. i have a form with a couple of buttons
for different tags, which all call the same function. the text on the
buttons changes from record to record. this is the problem area:

def showrecords(self):
"""this function updates the form labels to show the current
record"""
global gmax
global gctr
global CurrTitle
global CurrAuthor
global CurrTag1
global CurrTag2
global CurrTag3
global CurrTag4
global CurrTag5
global CurrAbstract
global CurrLocation
global CurrID
global HuntFor

self.Lbn.config(text=gmax)
self.Lbnof.config(text=gctr+1)
self.LbTitle.config(text=CurrTitle, justify=LEFT)
self.LbName.config(text=CurrAuthor)
self.LbPath.config(text=CurrLocation)
self.BtTag1.bind('',self.calltotags(tag=CurrTag1))
self.BtTag1.config(text=CurrTag1)
self.BtTag2.bind('',self.calltotags(tag=CurrTag2))
self.BtTag2.config(text=CurrTag2)
self.BtTag3.bind('',self.calltotags(tag=CurrTag3))
self.BtTag3.config(text=CurrTag3)
self.BtTag4.bind('',self.calltotags(tag=CurrTag4))
self.BtTag4.config(text=CurrTag4)
self.BtTag5.bind('',self.calltotags(tag=CurrTag5))
self.BtTag5.config(text=CurrTag5)
self.LbAbs.config(text=CurrAbstract)

def calltotags(event, tag):
# This function sets the search variable HuntFor value, and calls
the tagwork class.
global HuntFor
global toggle
HuntFor=tag
toggle="Tagcluster"
print HuntFor
tagwork()

when i click on the buttons, none of them call the function. i only see the
huntfor value in the prompt when i load the program. can someone please
enlighten me as to why this happens? (the buttons are loaded on the root
window in an earlier function, and i have the same problem even if i try
binding the events there)

also, can someone suggest a good (and free!) code editor for python please?

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

Issues regarding the download

2020-04-18 Thread MRIDULA GUPTA
Hi,
I am a new user and I am facing difficulty using the app. everytime I click
on the app the windows open which tell me either to modify the app or
repair it or uninstall it. I did my level best but still I am facing
problems installing it. please look into it as soon as possible.
-- 
https://mail.python.org/mailman/listinfo/python-list


adodb with mysql - connection string syntax for filepath

2007-09-16 Thread Mridula Ramesh
Dear all,

Hi. I am not very tech-savvy so please pardon me if this is a stupid
question: so far I have been googling for about 4 days to find help for
this, so now I am desperate! :)

How do you use adodb with mysql to connect to a file that is on your
machine?

Also, could you please recommend to me a good resource to learn more about
classes and modules from? i don't understand half of the _init_ business
that many sites mention. (This *is* something even a newbie needs to learn,
right?)

Thank you!

M.R.S.
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: adodb with mysql - connection string syntax for filepath

2007-09-18 Thread Mridula Ramesh
Hi. Firstly, thank you both very much for the response!

Cliff, I did some more reading up about it after  you corrected me re MySQL
not being a _language_  but another means of storing data (would you believe
NONE of the connection tutorials actually said that?!) Anyway, now I have
MySQL on my machine, and it's installed - if I say "import MySQLdb" in
python prompt, it does that, but I can't see any exe in the program's folder
itself: does that mean tables can only be created by code? *puzzled*

Steve, thank you too, I looked up the link you had given, but I do not yet
know which part of that site may help me... And I am now going to struggle
with Dive Into Python before attempting much else!

This is a nice, helpful mailing group!

Thanks again.




On 17/09/2007, Mridula Ramesh <[EMAIL PROTECTED]> wrote:
>
> Dear all,
>
> Hi. I am not very tech-savvy so please pardon me if this is a stupid
> question: so far I have been googling for about 4 days to find help for
> this, so now I am desperate! :)
>
> How do you use adodb with mysql to connect to a file that is on your
> machine?
>
> Also, could you please recommend to me a good resource to learn more about
> classes and modules from? i don't understand half of the _init_ business
> that many sites mention. (This *is* something even a newbie needs to learn,
> right?)
>
> Thank you!
>
> M.R.S.
>



-- 

CONSUL CONSOLIDATED PVT LTD.

9/6 1st street
Venkateshwara Nagar
Adyar
Madras 600 020
Ph  : 91 - 44 - 24468117
Fax : 91 - 44 - 24468082.
-- 
http://mail.python.org/mailman/listinfo/python-list

global name is not defined - but this is actually a function's name

2007-09-20 Thread Mridula Ramesh
hi.

i'm a beginner and i'm trying to get the hang of classes and functions. my
code looks like this:



class showRecord(main):
def __init__(self):
global gmax
#now to create the screen by placing all the widgets
rt = Tk()
showbuttons()
#call the scroller to DoSomething
scroll()

def showbuttons(self):
# NAVIGATION BAR--
NavBut1 = Button(rt, text="|<", width=6, height=2,
bg="DarkSeaGreen", fg="Black")
NavBut1.grid(row=10, column=20, padx=6, pady=6, columnspan=3)
NavBut2 = Button(rt, text="<<", width=6, height=2,
bg="DarkSeaGreen", fg="Black")
NavBut2.grid(row=10, column=25, padx=6, pady=6, columnspan=3)
#widget bindings
NavBut2.bind('', lambda e:GoPrev(ctr))



my problem is at the 6th line: showbuttons()
the error says "global name "showbuttons" is not defined but it's not a
global variable. what am i doing wrong?

also, should i say ...

def showbuttons(self):
or
def showbuttons(self, showRecord):

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

global name is not defined - but this is actually a function's name

2007-09-21 Thread Mridula Ramesh
thanks! that fixed it :)
-- 
http://mail.python.org/mailman/listinfo/python-list

calling the function of one class from another class

2007-09-22 Thread Mridula Ramesh
hi.

i currently have code structured like this:

classA():
> def __init__():
>  ..
>  ..
>
> def fnc1():
> 
> 
>
>
> classB():
>def __init__():
> 
> 
> classA.fnc1()#this is where i get an error
>

TypeError: unbound method fnc1() must be called with classA instance as
first argument (got nothing instead)

when i do  fnc1(classA) i get:

NameError: global name 'fnc1' is not defined

am i violating some programming rule by trying to call fnc1 in classB? i am
only now learning OO alongside python, so i'm not sure! also, can someone
please tell me where to go for more articles on the classes and functions
and calling them from other places?

thanks a lot!

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

Re: calling the function of one class from another class

2007-09-24 Thread Mridula Ramesh
thanks! ... sorry, i lacked access to the internet for a bit there... um,
no, i'm not trying to write in java style in python, because i don't even
know java!! i tried the "self" thing but that wasnt enough. I had to (as
Furkan Kuru said) use a new instance of that class and only then call the
function - that worked fine.

so a big belated thanks, everyone!

On 22/09/2007, Mridula Ramesh <[EMAIL PROTECTED]> wrote:
>
> hi.
>
> i currently have code structured like this:
>
> classA():
> > def __init__():
> >  ..
> >  ..
> >
> > def fnc1():
> > 
> > 
> >
> >
> > classB():
> >def __init__():
> > 
> > 
> > classA.fnc1()#this is where i get an error
> >
>
> TypeError: unbound method fnc1() must be called with classA instance as
> first argument (got nothing instead)
>
> when i do  fnc1(classA) i get:
>
> NameError: global name 'fnc1' is not defined
>
> am i violating some programming rule by trying to call fnc1 in classB? i
> am only now learning OO alongside python, so i'm not sure! also, can someone
> please tell me where to go for more articles on the classes and functions
> and calling them from other places?
>
> thanks a lot!
>
> mridula.
>
-- 
http://mail.python.org/mailman/listinfo/python-list

buttons keep jumping, frame loads on top of itself

2007-09-25 Thread Mridula Ramesh
hi.

my actual code is a bit too long to post here, but this is how the code
works : the application loads, the first screen appears. it is to view the
records in a database, so you can scroll and view records by clicking on the
standard navigation buttons ( |<, <<, >>, >| ).

the problem is that since all my navigation code is in one class, and the
display class is called from class navigation() to make frame and the
buttons, the frame and buttons are reloaded afresh each time.  this means
that if the text fields' lengths vary, the frame messily tends to move
around to accommodate them.

1. is it wrong (ie. inefficient/ slower/ BAD pgming practice!) to reload the
frame and its children widgets every time?
2. is there a way to clear the frame of the child widgets? - this would
solve the problem of the Jumping Buttons! frame.destroy() seems to be
crashing my application.

thank you for your patience!

regards,
mridula.
-- 
http://mail.python.org/mailman/listinfo/python-list

frame refresh or redraw for records?

2007-09-26 Thread Mridula Ramesh
hi.

my actual code is a bit too long to post here, but this is how the code
works : the application loads, the first screen appears. it is to view the
records in a database, so you can scroll and view records by clicking on the
standard navigation buttons ( |<, <<, >>, >| ).

the problem is that since all my navigation code is in one class, and the
display class is called from class navigation() to make frame and the
buttons, the frame and buttons are reloaded afresh each time.  this means
that if the text fields' lengths vary, the frame messily tends to move
around to accommodate them.

1. is it wrong (ie. inefficient/ slower/ BAD pgming practice!) to reload the
frame and its children widgets every time?
2. is there a way to clear the frame of the child widgets? - this would
solve the problem of the Jumping Buttons! frame.destroy() seems to be
crashing my  whole application. is there another way?

is it possible to make a function so that every time the main values change,
a series of events is triggered?

i'm sorry, i've searched quite a bit for this frame business, and so far
it's either not worked/ been incomprehensible!

thank you for your patience -
mridula.
-- 
http://mail.python.org/mailman/listinfo/python-list

Bug: spurious indentation error

2007-09-28 Thread Mridula Ramesh
hi.

is this the right place to report a bug?

i had written this by mistake:
   filemenu = Menu(menu) , bg="White")

instead of
  filemenu = Menu(menu, bg="Pink")

and the compiler kept giving me an indentation error in a line much further
down which was perfectly okay.

i am using python 2.5.1 with IDLE 1.2.1 on a windows XP machine.
anyone else struggling with the same thing, beware! :)

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

Re: Re: Bug: spurious indentation error

2007-09-28 Thread Mridula Ramesh
Hi.

Lol, nope, I checked today too, and it happened again. Try running this as a
script, not from the prompt -

class main():
def __init__(self):
rt.geometry("680x600")
rt.config(bg="CornSilk")
rt.title("my miniscule app")
#MENU
menu = Menu(rt)
rt.config(menu=menu)
# create a menu
filemenu = Menu(menu), bg="White") #syntax error/ typo in this line.
menu.add_cascade(label="Options", menu=filemenu)
filemenu.add_command(label="Add New")#, command=callback)
filemenu.add_command(label="Edit")
filemenu.add_command(label="Delete")
filemenu.add_separator()
filemenu.add_command(label="Exit")
self.dbConnect()
self.nowgather(gctr)
self.showfixed()
self.showrecords()

def dbConnect(self): #error gets thrown here as a tab-space indentation
error.
#connects to database D:/Catalogue.mdb, and gathers all data in a
recordset
#called rs. Puts this information into individual lists by field
name
global gmax
#setting record count to zero afresh.
import win32com.client
conn = win32com.client.Dispatch('ADODB.Connection')
DSN = 'PROVIDER=Microsoft.Jet.OLEDB.4.0; DATA
SOURCE=D:/Catalogue.mdb;'
conn.Open(DSN)
rs = win32com.client.Dispatch('ADODB.Recordset')
rs_name="MyRecordSet"
rs.Cursorlocation = 3
rs.Open('SELECT * FROM Library', conn)
gmax = rs.RecordCount


Regards,
Mridula.



This is probably a bug in your mind, not in the compiler ;-)

Without more detail (i.e. the complete code or a sizable and relevant
chunk of it, pkus the copied error message) it's impossible to say
exactly what was happening. However I am pretty confident that the
2.5.21 compiler will immediately report an unopened closing parenthesis
as a syntax error.

 >>> something = "abc".replace("c"), "d")
  File "", line 1
something = "abc".replace("c"), "d")
   ^
SyntaxError: invalid syntax
 >>>

So, what was the problem again? Give us a little more detail,  please.

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

Paned Window Widget Resize/ Refresh Trouble

2007-10-08 Thread Mridula Ramesh
Hi.

I am trying to show data using the paned window widget, and am encountering
this problem: whenever the vertical/horizontal resizing bars are moved, the
widgets and data on the panels are thrown out of alignment and sometimes
totally disappear. They only reappear when you sort of drag the panes across
in a trial-and-error manner. Also, when i update the labels to reflect a
current recordset, some of the labels disappear. Can someone please explain
what I am doing wrong?

I don't know if this will help, but this is what the problematic code looks
like:

def showtagcloud(self):
rts = Tk()
rts.title("Similarly Tagged Files")
rts.geometry("900x600")

pane1 = PanedWindow(rts)
pane1.pack(fill=BOTH, expand=1)
#LEFT PANE
left = Label(pane1, width=30)
pane1.add(left)
pane2 = PanedWindow(pane1, orient=VERTICAL)
pane1.add(pane2)
#TOP PANE
top = Label(pane2, height=210, width=45)
pane2.add(top)
#BOTTOM PANE
bottom = Label(pane2, height=5)
pane2.add(bottom)
pane1.paneconfig(left,minsize=400)
pane2.paneconfig(top,minsize=450)

LbForm = Label(left, text="File titles", justify=LEFT)
LbForm.pack(anchor=N, padx=5, pady=20)

LbDet = Label(top, text="File details", justify=LEFT)
LbDet.pack(anchor=N, padx=5, pady=20)

self.LbID = Label(top)
self.LbID.pack(padx=10, pady=3, anchor=NW)
self.LbTID = Label(top)
self.LbTID.pack(padx=15, pady=5, anchor=NW)
self.LbTitl = Label(top)
self.LbTitl.pack(padx=10, pady=3, anchor=NW)
self.LbTitle = Label(top)
self.LbTitle.pack(padx=15, pady=5, anchor=NW)
self.LbAu = Label(top)
self.LbAu.pack(padx=10, pady=3, anchor=NW)
self.LbAuth = Label(top)
self.LbAuth.pack(padx=15, pady=5, anchor=NW)
self.LbLoc = Label(top)
self.LbLoc.pack(padx=10, pady=3, anchor=NW)
self.LbPathway = Label(top)
self.LbPathway.pack(padx=15, pady=5, anchor=NW)
self.LbAbs = Label(top)
self.LbAbs.pack(padx=10, pady=3, anchor=NW)
self.LbAbst = Label(top)
self.LbAbst.pack(padx=15, pady=5, anchor=NW)


LbTc = Label(bottom, text="Other tags for this file:")
LbTc.pack(anchor=NW, padx=5, pady=20)
self.LbT1 = Label(bottom)
self.LbT1.pack(padx=10, pady=5)
self.LbT2 = Label(bottom)
self.LbT2.pack(padx=10, pady=5)
self.LbT3 = Label(bottom)
self.LbT3.pack(padx=10, pady=5)
self.LbT4 = Label(bottom)
self.LbT4.pack(padx=10, pady=5)
self.LbT5 = Label(bottom)
self.LbT5.pack(padx=10, pady=5)

self.LstTag = Listbox(left, selectmode=BROWSE)
ScrBarV = Scrollbar(left)
ScrBarH = Scrollbar(left, orient=HORIZONTAL)
self.LstTag.pack(side=LEFT,fill=Y)
ScrBarV.pack(side=RIGHT,fill=Y)
ScrBarV.config(command=self.LstTag.yview)
self.LstTag.config(width=60, yscrollcommand = ScrBarV.set)
for xno in range(0, self.gsmax-1):
self.LstTag.insert(END,str(self.pundoos[xno][1]))
self.LstTag.bind("<>", self.elaborate)

def elaborate(self, event):
temphold = self.LstTag.get(self.LstTag.curselection()[0])
for xno in range(0, self.gsmax-1):
if self.pundoos[xno][1]==temphold:
self.LbID.config(text="Index No.")
self.LbTID.config(text=self.pundoos[xno][0])
self.LbTitl.config(text="Title")
self.LbTitle.config(text=self.pundoos[xno][1],
wraplength=300, justify=LEFT)
self.LbAu.config(text="Author(s)")
self.LbAuth.config(text=self.pundoos[xno][2],
wraplength=300, justify=LEFT)
self.LbLoc.config(text="Path")
self.LbPathway.config(text=self.pundoos[xno][3],
wraplength=300, justify=LEFT)
self.LbAbs.config(text="Abstract")
self.LbAbst.config(text=self.pundoos[xno][4],
wraplength=300, justify=LEFT)

self.LbT1.config(text=self.pundoos[xno][5],wraplength=200,
justify=LEFT)
self.LbT2.config(text=self.pundoos[xno][6],wraplength=200,
justify=LEFT)
self.LbT3.config(text=self.pundoos[xno][7],wraplength=200,
justify=LEFT)
self.LbT4.config(text=self.pundoos[xno][8],wraplength=200,
justify=LEFT)
self.LbT5.config(text=self.pundoos[xno][9],wraplength=200,
justify=LEFT)

Thanks.

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