©2003 Kåre Sjölander and Jonas Beskow
Introduction Download Documentation Links Forum
WaveSurfer user forum

FAQ  FAQ
Search  Search
Memberlist  Memberlist
Register  Register
Profile  Profile
Login  Login

Getting the time of the center of the Wsurf widget's panes

 
Post new topic   Reply to topic    www.speech.kth.se/wavesurfer Forum Index -> WaveSurfer
View previous topic :: View next topic  
Author Message
mickel



Joined: 17 Dec 2002
Posts: 28
Location: Espoo, Finland

PostPosted: Wed Jul 02, 2003 6:32 am    Post subject: Getting the time of the center of the Wsurf widget's panes Reply with quote

I'm using the Wsurf widget from Python. Is there an attribute in the Wsurf widget that tells the time of the center of the currently visible part of the widget's panes? Or put it another way, is there a way to get the current left and right fractions of the visible part (out of which I could calculate the center time)?

Cheers,

/Mickel
Back to top
View users profile Send private message Visit posters website
kare



Joined: 16 Aug 2002
Posts: 371
Location: KTH, Centre for Speech Technology

PostPosted: Wed Jul 02, 2003 11:02 am    Post subject: Reply with quote

You can get the left and right times of the pane(s) using this statement

in Tcl
$widget cget -zoomfracs

in Python
widget.cget('zoomfracs')

where widget is a wsurf widget.

Kåre
Back to top
View users profile Send private message Visit posters website
mickel



Joined: 17 Dec 2002
Posts: 28
Location: Espoo, Finland

PostPosted: Wed Jul 02, 2003 11:30 am    Post subject: Reply with quote

This only works if you have already zoomed at least once as zoomfracs returns "0.0 0.0" otherwise. I've tried to get by this by saying "wsurf.xzoom(0.0, 1.0)" first and that does set the values that are returned by zoomfracs, but it constrains me to having to zoom out first, which might not be what I want.
Back to top
View users profile Send private message Visit posters website
Geoffrey



Joined: 03 Feb 2003
Posts: 32
Location: Belgium

PostPosted: Wed Jul 02, 2003 12:26 pm    Post subject: Reply with quote

You can use the following:
wsurf.tk.eval('[%s canvas] xview' % tcl_name_of_your_pane)

This returns you fractions of the pane corresponding to the left and right view boundaries.
You can easily get the time by multiplying those values by the length of the sound buffer.

Regards,
Geoffrey
Back to top
View users profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    www.speech.kth.se/wavesurfer Forum Index -> WaveSurfer All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2.0.1 © 2001, 2002 phpBB Group