473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Pan/Zoom Image class?

Hi All,

I'm just getting started rewriting a small CAD/GIS like application
for designating outlines of objects in photographs/images in Python.
Is there a class out there that already handles panning and zooming
along with lines that have been drawn on top of the object? If got a
simple scrolling canvas working and user designation of objects with
the mouse. But I'm wondering if there is an elegant solution that
handles zooming too. I'm using Tkinter with a canvas, but at this
point I could switch to any GUI package. Any recommendations?

Thanks!
-kurt

e.g. here is what i'm currently doing in a stripped down test program:

#!/usr/bin/env python
from Tkinter import *

class ScrolledCanvas(Frame):
def __init__(self, parent=None, color='white'):
Frame.__init__(self, parent)
self.pack(expand=YES, fill=BOTH)
self.photo=PhotoImage (file="01pc.gif")

canv=Canvas(self, bg=color, relief=SUNKEN)
canv.config(width=250, height=500)
canv.config(scrollregion=(0,0, 300, 1000))
canv.create_image(10,10, image=self.photo, anchor=NW)

sbarY=Scrollbar(self)
sbarY.config(command=canv.yview)
canv.config(yscrollcommand=sbarY.set)
sbarY.pack(side=RIGHT, fill=Y)

sbarX=Scrollbar(self,orient='horizontal')
sbarX.config(command=canv.xview)
canv.config(xscrollcommand=sbarX.set)
sbarX.pack(side=BOTTOM, fill=X)

canv.pack(side=LEFT, expand=YES, fill=BOTH)
Button(text="quit", command=self.quit).pack(fill=X)
if __name__ == '__main__':
ScrolledCanvas().mainloop()
Jul 18 '05 #1
1 6980
Hi,
I'm just getting started rewriting a small CAD/GIS like application
for designating outlines of objects in photographs/images in Python.
Is there a class out there that already handles panning and zooming
along with lines that have been drawn on top of the object?**If*got*a
simple scrolling canvas working and user designation of objects with
the mouse.**But*I'm*wondering*if*there*is*an*elegant*s olution*that
handles zooming too.**I'm*using*Tkinter*with*a*canvas,*but*at*this
point I could switch to any GUI package.**Any*recommendations?


You could go for pygame and/or pyopengl. I'm not sure if there is a way to
embed a pygame-window or opengl window into a canvas, but maybe you can
roll out your own toolkit-implementation on top of pygame. (There is even
one, based on pygame and opengl, but it seems to work only under windows,
which I don't have)

Diez
Jul 18 '05 #2

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

Similar topics

4
by: stef | last post by:
Hello: I am trying to design a web page whose graphics content would change according to the "text Zoom" settings of the user. (Basically the goal is to use mathematical symbols that...
0
by: ACaunter | last post by:
Hi there, I have an image on my ASP.Net page and i created a <p> tag that can be dragged around the screen.. I needed to get it so that when the <p> tag is over the image, whatever is inside, or...
2
by: Mo Ade via .NET 247 | last post by:
How do I write code to include a zoom feature in my project so that when my Vb Form loads an image I can click in my main menu zoom in or zoom out? -------------------------------- From: Mo Ade ...
6
by: Rich | last post by:
Hello, I am putting together a simple picture viewing program to view jpg. bmp pictures. I have the picturebox sizemode set to autosize. I have the picturebox in a pannel set to autoscroll, so...
1
by: Ricardo Furtado | last post by:
I've been with a problem for about two months and i've bought books and search the internet for an explanation, and haven't found one. I'm developing a cephalometric software, that needs to capture...
3
by: Keith G Hicks | last post by:
In MS Access image controls there's a property setting for "Size Mode" --> Clip, Zoom or Stretch. I don't see any similar property in an asp image control. When I have an image on a page, it seems...
4
by: Yoshitha | last post by:
I'm developing windows application using c#.net (vs 2003), i've placed several images (picture boxes) in panel control and i want to zoom the panel control so that the images and text which...
4
by: wasishincar | last post by:
I'm trying to read a bitmap and zoom in/out it on screen. I wrote some code but it did not perform as I expect. The bitmap shift 1 pixel to the upper-left coner when zooming in/out button was...
0
by: murry19830507 | last post by:
i want creat an web application(c#.net),which contains an image and one radiobutton list with 3 radiobuttons(zoom in ,zoom out ,zoom window) when user checked on zoom in imge has to be zoom inthe...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...
0
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...

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.