473,835 Members | 1,987 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

sum fonction in gadfly

I am writing a prototype program whose aim is to collect bookkeeping
transactions in a Database ( Gadfly).
After creating the table I create the variables with
varAmount = StringVar()
I then create labels in Tkinter to ease the input of data.
With a function
def treatment ():
requete = "insert into transactions ( date,amount,,.. ..)
values(......) "% (varDate.get(),
varAmount.get
I transfer data from the labels in Tkinter into the Database at the end
of the program
with a button named "End" . I print the Database with print cur.pp().
No problem up to now but then I try to use a select command:
cur.execute ("select sum(amount) from transactions"). I get

Sum.amout.trans action
=============== ==
100-10.5.......

instead of 110.5

It means that the select command does not add but concatenates the
different amounts. Why ?

Many thanks if you can help me.

Jean Moser

Jun 24 '06 #1
8 1400
jean-jeanot wrote:
After creating the table I create the variables with
varAmount = StringVar() Maybe you want to use DoubleVar or IntVar here?
With a function
def treatment ():
requete = "insert into transactions ( date,amount,,.. ..)
values(......) "% (varDate.get(),
varAmount.get Or float(varAmount .get()) |
int(round(100 * float(varAmount .get()))) here
cur.execute ("select sum(amount) from transactions"). I get
Sum.amout.trans action
=============== ==
100-10.5.......

instead of 110.5

It means that the select command does not add but concatenates the
different amounts. Why ?

Sounds like you selected columns are strings, not numbers.
Remember '123.5' + '-23' is '123.5-23', while 123.5 + -23 is 100.5
You need the amount column of the transactions table in the gadfly
database to be a numeric type, not a string type.

--Scott David Daniels
sc***********@a cm.org
Jun 24 '06 #2
I haven't been keeping up. Is Gadfly still in development?

Jun 24 '06 #3
Thank you for your help. I have changed StringVar in IntVar and it
works! I didn't know that IntVar (as StringVa) were Tkinter Widget
variables! (It is important to read the doc!) I made another mistake
in the value definition. I'have changed '%s' in %d and it goes
perfectly well.
It could be useful for me to change of DB ? Which one ? Postgresql or
another ?

Jean Moser

Scott David Daniels a écrit :
jean-jeanot wrote:
After creating the table I create the variables with
varAmount = StringVar()

Maybe you want to use DoubleVar or IntVar here?
With a function
def treatment ():
requete = "insert into transactions ( date,amount,,.. ..)
values(......) "% (varDate.get(),
varAmount.get

Or float(varAmount .get()) |
int(round(100 * float(varAmount .get()))) here
cur.execute ("select sum(amount) from transactions"). I get
Sum.amout.trans action
=============== ==
100-10.5.......

instead of 110.5

It means that the select command does not add but concatenates the
different amounts. Why ?

Sounds like you selected columns are strings, not numbers.
Remember '123.5' + '-23' is '123.5-23', while 123.5 + -23 is 100.5
You need the amount column of the transactions table in the gadfly
database to be a numeric type, not a string type.

--Scott David Daniels
sc***********@a cm.org


Jun 25 '06 #4
jean-jeanot wrote:
Thank you for your help. You're welcome.
It could be useful for me to change of DB ? Which one ? Postgresql or
another ?

Well, if gadfly is serving you well, you might as well stay with it.
Python 2.5 comes with sqlite3, which might well be a nice small step.
I find Postgresql to be a real solid DB, and a company I've been talking
with likes MySQL -- which finally has transactions (one of my personal
requirements before I'll call a DBMS "real").

Really, you should decide what you want the DBMS to do, and try to get
those requirements out; you'll get better advice.

--Scott David Daniels
sc***********@a cm.org
Jun 25 '06 #5

Robert Hicks wrote:
I haven't been keeping up. Is Gadfly still in development?


I always find this question a little
irritating -- gadfly is perfect the
way it is :). If it ain't broke don't
fix it. At least until the python guys
make another non-backwards-compatible
change that makes a patch necessary
(speaking of things that irritate me...).

Seriously, there are a few problems
that could be fixed that I can
think of, but mostly it works for what
it is -- why are people so concerned
that it's not changing?

-- Aaron Watters
http://gadfly.sourceforge.net/ --perfect already
http://xsdb.sourceforge.net/ --getting there

===
You'd be paranoid too if everyone was out to get you.

Jun 29 '06 #6

aa************* **@yahoo.com wrote:
Robert Hicks wrote:
I haven't been keeping up. Is Gadfly still in development?


I always find this question a little
irritating -- gadfly is perfect the
way it is :). If it ain't broke don't
fix it. At least until the python guys
make another non-backwards-compatible
change that makes a patch necessary
(speaking of things that irritate me...).

Seriously, there are a few problems
that could be fixed that I can
think of, but mostly it works for what
it is -- why are people so concerned
that it's not changing?


I didn't mean to be irritating and I wasn't concerned about it not
changing but I could probably have stated the question a little better.
For some reason I thought it was a dead project so maybe "still being
maintained" would be a better statement. I dunno.

Robert

Jun 30 '06 #7

Robert Hicks wrote:
aa************* **@yahoo.com wrote:
.... why are people so concerned
that it's not changing?


I didn't mean to be irritating and I wasn't concerned about it not
changing but I could probably have stated the question a little better.
For some reason I thought it was a dead project so maybe "still being
maintained" would be a better statement. I dunno.


You're not the only one. Why do I keep seeing "gadfly...d ead"
in the same sentence?

What if it doesn't need maintenance? Does that make it dead?
No offense to you personally, you are just repeating what
everyone else has been saying for years for reasons that
totally escape me. Several times people have suggested that
gadfly be added to the python standard library and then the
question comes up... who will maintain it? And I answer I'll
maintain it if anyone finds serious problems with it and then
a few months later I hear that it was decided that gadfly was
a dead project. This has been going on since about '97.
It's irritating and tiresome. Sorry, I'm grumpy today.

-- Aaron Watters

===
my mazarati goes 185
I lost my license
now I don't drive -- from "Life's been good"

Jun 30 '06 #8

aa************* **@yahoo.com wrote:
Robert Hicks wrote:
aa************* **@yahoo.com wrote:
.... why are people so concerned
that it's not changing?


I didn't mean to be irritating and I wasn't concerned about it not
changing but I could probably have stated the question a little better.
For some reason I thought it was a dead project so maybe "still being
maintained" would be a better statement. I dunno.


You're not the only one. Why do I keep seeing "gadfly...d ead"
in the same sentence?

What if it doesn't need maintenance? Does that make it dead?
No offense to you personally, you are just repeating what
everyone else has been saying for years for reasons that
totally escape me. Several times people have suggested that
gadfly be added to the python standard library and then the
question comes up... who will maintain it? And I answer I'll
maintain it if anyone finds serious problems with it and then
a few months later I hear that it was decided that gadfly was
a dead project. This has been going on since about '97.
It's irritating and tiresome. Sorry, I'm grumpy today.

Hey, that is okay. I know now never to ask that question. : D

Robert

Jun 30 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1852
by: Patrick W. Fraley | last post by:
Hi Everybuddy, I am having a little problem I can not find a solution for. I am trying to use the SQL-LIKE statement in gadfly. After googling around I found out that it is not supported, and that on is supposed to use a regular expression. All great, but there is nowhere a reference to be found on how to do this. No examples, no nothing, just the comment to use regular expressions.
4
2074
by: Brian O. Bush | last post by:
A while ago, I recall hearing that Gadfly might be included into the python standard library. What happened? As I recall, the issue was the license. Brian
3
1445
by: R.Marquez | last post by:
I tried installing gadfly 1.0 on Mandrake 9.2 and got the following: # python setup.py install running install error: invalid Python installation: unable to open /usr/lib/python2.3/config/Makefile (No such file or directory) # Of course, the error is correct in that there is no such file. There is not even a python2.3/ config directory. Is the Mandrake
1
1414
by: Ian Pellew | last post by:
Hi all; Is there a Windows version of gadfly anywhere? All my searching gets me to Linux stuff (not that I have anything against Linux, rather I use Solaris) Regards Ian
0
1276
by: Thomas | last post by:
Hi, i have a webserver with (approx.) the code below, but whatever i do the html code sent to the browser stays the same. The strangest is, if i insert a local variable in the class which is incremented upon each call to self.render_GET() and append it to the html code, it increments correctly on the browser. Could it be a probem with gadfly? from twisted.web import resource, server
0
1089
by: Tommy | last post by:
Hello I've got problems while using py2exe, because of a module I'm using : gadfly In fact, I had the same problem with Pmw, and the solution was to create a single file Pmw.py which contained all the parts of the original module, and to put it in the project's main folder. So, I'd like to make a "freezed" version of gadfly, in order to create a fixed win32 exe. But it's more difficult than with Pmw... so does anyone know another way...
3
5237
by: Philippe Mesmeur | last post by:
J'ai eu une longue discussion hier au sujet des parametres de fonction const. La personne etait pour mettre "const" devant TOUS les parametres ne devant pas etre modifies. A mon avis, il faut le faire que SI le parametre est un pointeur ou une référence. int fct1(const int* i);
3
1517
by: niko | last post by:
Hello, while using gadfly, got an error that i don't understand. Code is as follow : cursor = connection.cursor() cursor.execute('select id_m from mots where nom_m = "%s"' % nom_m) id_m = cursor.fetchall() Error message : File "C:\Python24\Lib\site-packages\gadfly\kjParser.py", line 567, in getmember
6
1662
by: Ralf Muschall | last post by:
Hello, I just tried the recent gadfly (from SF), using Python 2.4.2 (hand built, since my Suse 8.2 had only 2.2.2). The direct operation of gadfly works. After calling gfserver, I get (in addition to a complete users manual dumped on the screen) the following error message:
0
9803
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9652
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10808
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10520
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10560
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9344
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
4433
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3993
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3088
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.