Nieuws:

Welkom, Gast. Alsjeblieft inloggen of registreren.
Heb je de activerings-mail niet ontvangen?

Auteur Topic: in Python: Vector afbeelding weergeven.; lijnen en cirkels invoegen.  (gelezen 1315 keer)

Offline bart85

  • Lid
In een programma voor het biljarten wil ik het biljart tekenen met ballen en lijnen.
Hoe dit in een vector afbeelding zetten?
Relying on complex tools to manage and build your system is going to hurt the end-users. [...] "If you try to hide the complexity of the system, you'll end up with a more complex system". Layers of abstraction that serve to hide internals are never a good thing. Instead, the internals should be designed in a way such that they NEED no hiding.

— Aaron Griffin

Offline bart85

  • Lid
Re: in Python: Vector afbeelding weergeven.; lijnen en cirkels invoegen.
« Reactie #1 Gepost op: 2013/11/01, 15:03:05 »
Hoe kan ik in Python een afbeelding openen en laten zien?
Hoe teken ik punten, lijnen en cirkels aan de hand van coördinaten?
Relying on complex tools to manage and build your system is going to hurt the end-users. [...] "If you try to hide the complexity of the system, you'll end up with a more complex system". Layers of abstraction that serve to hide internals are never a good thing. Instead, the internals should be designed in a way such that they NEED no hiding.

— Aaron Griffin

Offline bart85

  • Lid
Re: in Python: Vector afbeelding weergeven.; lijnen en cirkels invoegen.
« Reactie #2 Gepost op: 2013/11/01, 17:08:20 »
#!/usr/bin/env python

import tkFileDialog
from Tkinter import *
from PIL import Image
import os

root= Tk()
filename = 'biljart.jpg'
img = Image.open(filename)

Hoe deze afbeelding laten zien in het venster root?
Relying on complex tools to manage and build your system is going to hurt the end-users. [...] "If you try to hide the complexity of the system, you'll end up with a more complex system". Layers of abstraction that serve to hide internals are never a good thing. Instead, the internals should be designed in a way such that they NEED no hiding.

— Aaron Griffin

Offline bart85

  • Lid
Re: in Python: Vector afbeelding weergeven.; lijnen en cirkels invoegen.
« Reactie #3 Gepost op: 2013/11/02, 19:20:37 »
    from PIL import Image, ImageTk
ImportError: cannot import name ImageTk
Relying on complex tools to manage and build your system is going to hurt the end-users. [...] "If you try to hide the complexity of the system, you'll end up with a more complex system". Layers of abstraction that serve to hide internals are never a good thing. Instead, the internals should be designed in a way such that they NEED no hiding.

— Aaron Griffin