Showing posts with label drawing lines. Show all posts
Showing posts with label drawing lines. Show all posts

Wednesday, 13 February 2019

Changing Colours

img_a_01

Well, in this opportunity I got some simple animation that involves a straight line that change its colour between 4 options in a fixed order, it's a relatively simple task, although I've seen codes that involve the use of objects and classes, so I hope to get a better understanding on them before posting about it.

Tuesday, 8 August 2017

Mach Number Calculator

img_a_01

Code for the simple Mach Number calculator:

from Tkinter import *

def mc():
    # 1st Function
    try:
        ns00, ns01 = a00.get(), a01.get()
        ns02, ns03 = a02.get(), a03.get()
        V = ns00
        k = ns01
        R = ns02
        T = ns03  

Thursday, 28 January 2016

Canvas - Drawing Lines


The first code is a simple example:
from Tkinter import *
root = Tk()
c1 = Canvas(root, height = 180, width = 200)
c1.create_line(20, 20, 160, 160, fill = "orange"  , width = 3)
c1.create_line(40, 50, 100, 110, fill = "yellow"  , width = 3)
c1.pack()
root.title("Lines")
root.mainloop()
 
We must create a canvas using the "Canvas" method, also its dimensions are declared here.