Re: problem with money datatype based calculations in python
Do calculations in postgresql and then call that calculated value from the python.So no need to calculate in python at all Njoy the share of Freedom, Anusha Kadambala On Sat, May 2, 2009 at 1:15 PM, Krishnakant wrote: > hello all, > I am using postgresql as a database server for my db application. > > The database is related to accounts and point of sales and many > calculations involve money datatype. > > The application logic is totally done in python. Now the problem is > that there is a situation where we calculate tax on % of the total > amount on the invoice. The percentage is in terms of float but the > eventual amount has to be in a money datatype. > > The product cost comes in money datatype from postgresql and the tax % > comes in float. So I would like to know if python supports some thing > similar to money datatype so that I can cast my total amount (in money ) > divided by tax% (in float ) so money divided by float should be the > result and that result should be in money datatype. > For example a product x has the cost Rs. 100 which is stored in the > tabel as money type. and in the tax table for that product the VAT is > 5% and this 5% is stored in float datatype. So after using both these > values the resulting total 105Rs. should be in money type and not float. > I awaite some reply, > Thanks in advice. > happy hacking. > Krishnakant. > > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list
threading issue
hi, i am using pygtk,glade in the front end and postgresql,python-twisted (xmlrpc) as the back end.My issue is i am trying to add the progress bar in my application but when the progress bar comes up it is blocking the backend process.So i started using threading in my application.But when i added that it is working but i am not able to destroy the window where the progress bar is present, which is part of main window. my code is class ledger(threading.Thread): """This class sets the fraction of the progressbar""" #Thread event, stops the thread if it is set. stopthread = threading.Event() .. wTree = gtk.glade.XML('gnukhata/main_window.glade','window_progressbar') window = wTree.get_widget('window_progressbar') window.set_size_request(300,50) progressbar = wTree.get_widget('progressbar') #window.connect('destroy',self.main_quit) window.show_all() def run(self): """Run method, this is the code that runs while thread is alive.""" #Importing the progressbar widget from the global scope #global progressbar course = True #While the stopthread event isn't setted, the thread keeps going on while course : # Acquiring the gtk global mutex gtk.gdk.threads_enter() #Setting a random value for the fraction l=0.1 while l<1: self.progressbar.pulse() time.sleep(0.1) l=l+0.1 queryParams = [] res1=self.x.account.getAllAccountNamesByLedger(queryParams) for l in range(0,len(res1)): ;; # Releasing the gtk global mutex gtk.gdk.threads_leave() #Delaying 100ms until the next iteration time.sleep(0.1) course = False #gtk.main_quit() global fs print 'anu' #Stopping the thread and the gtk's main loop fs.stop() #window.destroy() self.ods.save("Ledger.ods") os.system("ooffice Ledger.ods") def stop(self): """Stop method, sets the event to terminate the thread's main loop""" self.stopthread.set() * njoy the share of freedom, Anusha Kadambala -- http://mail.python.org/mailman/listinfo/python-list
covert number into string
Hi, Can anyone tell me how to convert number to words For example: If number = then it should give me *Nine thousand nine hundred ninetynine* Is there any build-in function or something that can do this for me Thank you in advance Anusha Kadambala -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and glade program - without errors but didn't display anything
hi, You forgot to show the window.So in init method of py file and add self.window = self.wTree.get_widget("window_calculator") self.window.show() Njoy the share of Freedom, Anusha Kadambala On Tue, Sep 1, 2009 at 2:04 PM, Raji Seetharaman wrote: > Hi all, > i tried to develop a calculator using glade and python. > When i run the script(python calculatorglade.py), i didn't get any errors. > A calculator gui is supposed to be displayed. But no window appears. > With Ctrl + C, i killed it. I got the following response from the terminal > > ^CTraceback (most recent call last): > File "calculatorglade.py", line 106, in > gtk.main() > KeyboardInterrupt > > The Python program is available here, http://pastebin.com/m44d2c1cb > > The corresponding Glade xml file is available here, > http://pastebin.com/m46beaac5 > > What should i do to display the gui window? > > Regards > Raji. S > > -- > http://mail.python.org/mailman/listinfo/python-list > > -- http://mail.python.org/mailman/listinfo/python-list