Hi,
I'm a relative newb to Python and I'm starting my first major project - a logarithmic graphing system. I'm using tkinter for the GUI part of the design, but I've run into a problem. Basically, I want my graph (a tk canvas) to appear in the same (root) window as the buttons that control it. How do I go about this? Any help would be greatly appreciated. Thanks in advance :)
# plot of log line
from tkinter import *
import math
def particleCount(decay, p0, time):
p = (p0*math.e)**(-(decay*time))
return (p)
# define root window
root = Tk()
root.title("Radioactive Decay Graph")
# set canvas properties
width = 400
height = 400
center = height*(5/6)
x_increment = 1
# invoke canvas
c = Canvas(width=width, height=height, bg='black')
c.pack()
# add string
str1 = "Logarithmic decay graph"
c.create_text(10, 20, anchor=SW, text=str1)
# line width stretch
x_factor = 1
# line height stretch
y_amplitude = -300
center_line = c.create_line(0, center +1, width, center+1, fill='green')
coordinates = []
coord = []
for x in range(0, 600):
# x coordinates
coord.append((x * x_increment) * x_factor)
# y coordinates
y = particleCount((1.16*(10**-3)), (5*(10**6)), x)
coord.append((y * y_amplitude) + center)
coordinates.append(coord)
coord = []
log_line = c.create_line(coordinates, fill='red')
root.mainloop()