Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: GUIs in Tk.:Zinc; a perl module experiment

by zentara (Archbishop)
on Nov 02, 2008 at 21:01 UTC ( [id://720980]=note: print w/replies, xml ) Need Help??


in reply to GUIs in Tk.:Zinc; a perl module experiment

I find lots of information about creating composite widgets in Tk; I don't find so much about how to create 'composite items' on a Canvas, or Zinc specifically, which is what I do (?) in my code. Can you point me to some code that implements objects that represent complex item collections on a canvas? (or documentation of such a pattern)

I already pointed you to the TripleRotatingWheel in the Zinc demo, and the Bubbles on Zinc at Re^3: Tk/Zinc mouse drag performance issues? I use the ztkbubble example as a basis for making almost any type of composite item on Zinc.

I think basically the idea is to bless an object with Zinc as the parent, then make a group in it. Then have methods for the object and internal timers to make it alive. :-)

Other than that, this is beginning to sound like work. :-)

I'm not really an OO oriented type of programmer, but to me there are 2 possible paths....

1. Create your Zinc canvas, and pass it as an option to your new class, like ztkbubble, so you can have a parent widget for your objects.

2. Subclass Zinc, and make your own Zinc class. You can then add your own methods etc to it.

Your script works well here, fast and peppy, but with that grabglobal, I can't start a top to see cpu usage. :-)


I'm not really a human, but I play one on earth Remember How Lucky You Are
  • Comment on Re: GUIs in Tk.:Zinc; a perl module experiment

Replies are listed 'Best First'.
Re^2: GUIs in Tk.:Zinc; a perl module experiment
by rocklee (Beadle) on Nov 03, 2008 at 15:06 UTC

    Appreciate your feedback as always, Sir!

    I use the ztkbubble example as a basis for making almost any type of composite item on Zinc.

    I think you missed the operative word 'complex', and I failed to explain properly as is tradition by now. Specifically I need to create objects that have one-to-one, one-to-many or many-to-many relationships. Each object has a visual representation on the canvas (filled curve in most cases); Each relationship has a visual representation on the canvas (bezier). I can figure out how to do this -- the question is if some project exists that use Zinc (or canvas) to visualize complex relationships between objects; ie how to best approach this problem in an efficient way using PTK, hopefully saving me hours upon hours of experiments and refactoring ;-)

    Subclassing Zinc might be a viable option for me - I will look into this. When I understand bless(). ;-)

      Subclassing Zinc might be a viable option for me - I will look into this. When I understand bless()

      Look at Tk::CanvasDirTree where I subclass the Tk::Canvas. You could easily substitute Zinc in that, with minor syntax changes for things like finding the root group and scrollbar control, etc.

      You might want to post a new node asking about modules for handling complex interactions, I'm sure I've seen it discussed here before.


      I'm not really a human, but I play one on earth Remember How Lucky You Are

        Oh great! From browsing it quickly (at work;) it seems to contain quite a few useful pointers. OTOH I am also considering the Zinc C API to do the dirty work - obviously faster, and possibly easier to maintain in the long run.

        I guess I'll post a node when I have some more specific questions on this subject.

        Thanks again :-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://720980]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-24 21:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found