how to play a sound file repeatedly in loop

2010-05-08 Thread varnikat t
How to run sound file repeatedly in loop ?

When I do this, it does nothing and terminates:

import pygst
pygst.require(0.10)
import gst, gtk


n=0

while n10:
player = gst.element_factory_make(playbin2, player)
player.set_property(uri, file:/home/varnika/hello.ogg)
player.set_state(gst.STATE_PLAYING)
n=n+1

Regards
Varnika Tewari
-- 
http://mail.python.org/mailman/listinfo/python-list


How to check when OCRing is finished

2010-05-03 Thread varnikat t
Hi,
How to check if OCR engine  like cuneiform,ocropus,ocrad OCRing an image has
completed the job if running it from a  python program?

I am using a progress bar on the front end to show the OCRing progress
happening in background but how to stop progress bar automatically when
OCRing is done.

As of now, I am just running the timer for a few seconds (considering the
maximum time taken by ocropus and for high resolution image) but then the
OCRing time varies for different engines and different images.Some take less
and some take more.

Any solutions?

Regards
Varnika Tewari
(UMIT,SNDT University)
-- 
http://mail.python.org/mailman/listinfo/python-list


keyboard shortcuts glade+python

2010-04-27 Thread varnikat t
How to use keyboard shortcuts like ctrl+o for opening a file from menubar
menuitm OPEN in python+GLADE?

-- 
Varnika Tewari
-- 
http://mail.python.org/mailman/listinfo/python-list


How to display .txt file in textview of glade

2010-04-14 Thread varnikat t
Hi,
Whenever I try to open a .txt file in textview of glade, it never opens and
throws this error:
GtkWarning: gtk_text_buffer_emit_insert: assertion `g_utf8_validate (text,
len, NULL)' failed

self.text_view.get_buffer().insert(self.text_view.get_buffer().get_end_iter(),
\n + file.read())

It opens .py, .html, etc. nicely but doesn't open .txt file.
Can anyone temme what to do in order to display a .txt file?
Do i need to convert .txt file into something else...? there is some UTF-8
encoding problemi guess.
Please help me.

-- 
Varnika Tewari
-- 
http://mail.python.org/mailman/listinfo/python-list


how to get text from a html file?

2010-04-13 Thread varnikat t
Hi,
Can anyone tell me how to get text from a html file?I am trying to display
the text of an html file in textview(of glade).If i directly display the
file,it shows with html tags and attributes, etc. in textview.I don't want
that.I just want the text.
Can someone help me with this?


Regards
Varnika Tewari
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to open and read an unknown extension file

2010-04-09 Thread varnikat t
Hey thanks a lot to all of youNow i understood the concept and can use
it the right way

I have another doubt regarding using radio buttons

I am using two radio buttons for user to select either of the two options:

Landscape
Portrait

When i run the program it shows both radio buttons are active
I don't know how to toggle between the two radio buttons.
Also I want to display the respective image with them Landscape and portrait
at the top of each optionCan anyone help me with this?

On Fri, Apr 9, 2010 at 6:05 AM, Tim Chase python.l...@tim.thechases.comwrote:

 On 04/08/2010 12:22 PM, varnikat t wrote:

 it gives me this error

 TypeError: coercing to Unicode: need string or buffer, list found

 Thanks for the help.it detects now using glob.glob(*.*.txt)

 Can u suggest how to open and read file this way?

 *if glob.glob(*.*.txt):
 file=open(glob.glob(*.*.txt))

 self.text_view.get_buffer().set_text(file.read())
 else:
 file=open(glob.glob(*.*.html))

 self.text_view.get_buffer().set_text(file.read())


 glob() returns a list of matching files, not a string.  So you need to
 iterate over those files:

  filenames = glob.glob('*.*.txt')
  if filenames:
for filename in filenames:
  do_something_text(filename)
  else:
for filename in glob('*.*.html'):
  do_something_html(filename)

 -tkc






-- 
Varnika Tewari
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to open and read an unknown extension file

2010-04-09 Thread varnikat t
And I am using python and GLADE for GUI

On Fri, Apr 9, 2010 at 6:30 PM, varnikat t varnika...@gmail.com wrote:

 Hey thanks a lot to all of youNow i understood the concept and can use
 it the right way

 I have another doubt regarding using radio buttons

 I am using two radio buttons for user to select either of the two options:

 Landscape
 Portrait

 When i run the program it shows both radio buttons are active
 I don't know how to toggle between the two radio buttons.
 Also I want to display the respective image with them Landscape and
 portrait at the top of each optionCan anyone help me with this?


 On Fri, Apr 9, 2010 at 6:05 AM, Tim Chase 
 python.l...@tim.thechases.comwrote:

 On 04/08/2010 12:22 PM, varnikat t wrote:

 it gives me this error

 TypeError: coercing to Unicode: need string or buffer, list found

 Thanks for the help.it detects now using glob.glob(*.*.txt)

 Can u suggest how to open and read file this way?

 *if glob.glob(*.*.txt):
 file=open(glob.glob(*.*.txt))

 self.text_view.get_buffer().set_text(file.read())
 else:
 file=open(glob.glob(*.*.html))

 self.text_view.get_buffer().set_text(file.read())


 glob() returns a list of matching files, not a string.  So you need to
 iterate over those files:

  filenames = glob.glob('*.*.txt')
  if filenames:
for filename in filenames:
  do_something_text(filename)
  else:
for filename in glob('*.*.html'):
  do_something_html(filename)

 -tkc






 --
 Varnika Tewari




-- 
Varnika Tewari
-- 
http://mail.python.org/mailman/listinfo/python-list


How to open and read an unknown extension file

2010-04-08 Thread varnikat t
I am trying to do this
if os.path.exists(*.*.txt):
file=open(*.*.txt)
self.text_view.get_buffer().set_text(file.read())
else:
file=open(*.*.html)
self.text_view.get_buffer().set_text(file.read())

It gives error *.*.txt not existingThere are two files in the folder
testing.pnm.txt
and testing.pnm.html
How to make it open any name and extension file and read it?

Regards
Varnika Tewari
-- 
http://mail.python.org/mailman/listinfo/python-list


How to open and read an unknown extension file

2010-04-08 Thread varnikat t
Hey,
Thanks for the help.it detects now using glob.glob(*.*.txt)
Can u suggest how to open and read file this way?

*if glob.glob(*.*.txt):
file=open(glob.glob(*.*.txt))

self.text_view.get_buffer().set_text(file.read())
else:
file=open(glob.glob(*.*.html))

self.text_view.get_buffer().set_text(file.read())
*

This gives error!!


On Thu, Apr 8, 2010 at 9:12 PM, Kushal Kumaran 
kushal.kumaran+pyt...@gmail.com kushal.kumaran%2bpyt...@gmail.com wrote:

 On Thu, Apr 8, 2010 at 9:00 PM, varnikat t varnika...@gmail.com wrote:
  I am trying to do this
  if os.path.exists(*.*.txt):
  file=open(*.*.txt)
  self.text_view.get_buffer().set_text(file.read())
  else:
  file=open(*.*.html)
  self.text_view.get_buffer().set_text(file.read())
 
  It gives error *.*.txt not existingThere are two files in the folder
  testing.pnm.txt
  and testing.pnm.html
  How to make it open any name and extension file and read it?
 

 os.path.exists does not do pattern matching like that.  Take a look at
 the glob module.

 --
 regards,
 kushal




-- 
Varnika Tewari



-- 
Varnika Tewari
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to open and read an unknown extension file

2010-04-08 Thread varnikat t
it gives me this error

TypeError: coercing to Unicode: need string or buffer, list found


On Thu, Apr 8, 2010 at 10:48 PM, varnikat t varnika...@gmail.com wrote:





 Hey,
 Thanks for the help.it detects now using glob.glob(*.*.txt)
 Can u suggest how to open and read file this way?

 *if glob.glob(*.*.txt):
 file=open(glob.glob(*.*.txt))

 self.text_view.get_buffer().set_text(file.read())
 else:
 file=open(glob.glob(*.*.html))

 self.text_view.get_buffer().set_text(file.read())
 *

 This gives error!!


 On Thu, Apr 8, 2010 at 9:12 PM, Kushal Kumaran 
 kushal.kumaran+pyt...@gmail.com kushal.kumaran%2bpyt...@gmail.comwrote:

 On Thu, Apr 8, 2010 at 9:00 PM, varnikat t varnika...@gmail.com wrote:
  I am trying to do this
  if os.path.exists(*.*.txt):
  file=open(*.*.txt)
  self.text_view.get_buffer().set_text(file.read())
  else:
  file=open(*.*.html)
  self.text_view.get_buffer().set_text(file.read())
 
  It gives error *.*.txt not existingThere are two files in the folder
  testing.pnm.txt
  and testing.pnm.html
  How to make it open any name and extension file and read it?
 

 os.path.exists does not do pattern matching like that.  Take a look at
 the glob module.

 --
 regards,
 kushal




 --
 Varnika Tewari



 --
 Varnika Tewari




-- 
Varnika Tewari
-- 
http://mail.python.org/mailman/listinfo/python-list