From 41c2aecf88dee9efe9896171d4d70dc89f0c4d75 Mon Sep 17 00:00:00 2001 From: Haldrup-tech Date: Thu, 10 Oct 2024 21:07:33 -0400 Subject: [PATCH] Added test to try out new screen --- main.py | 10 ++++++---- test2.py | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 test2.py diff --git a/main.py b/main.py index f44bb8b..5ea5db9 100644 --- a/main.py +++ b/main.py @@ -37,7 +37,7 @@ current1_data = [] current2_data = [] -plt.ion() +"""plt.ion() fig, (ax, ax2) = plt.subplots(2, 1, figsize=(5, 5)) line, = ax.plot([], [], 'r-') line2, = ax.plot([], [], 'g-') @@ -56,6 +56,7 @@ ax2.set_ylabel('Current', fontsize = 6) ax2.set_title('Current/time', fontsize = 8) plt.subplots_adjust(hspace=0.4) +""" slider1 = Slider(20, 20, 100, 20, 20, SENSOR_DISTANCE / 2, 80) slider2 = Slider(20, 50, 100, 20, .1, 10, 1) @@ -144,18 +145,18 @@ while run: if (volume > y_lim): y_lim = volume + (volume * 1.2) - ax.set_ylim(-1000, y_lim) + #ax.set_ylim(-1000, y_lim) if (current1 > y_lim2): y_lim2 = current1 + (current1 * 1.2) - ax2.set_ylim(-1 * y_lim2, y_lim2) + #ax2.set_ylim(-1 * y_lim2, y_lim2) time_data.append(time) volume_data.append(volume) - line.set_xdata(time_data) + """line.set_xdata(time_data) line.set_ydata(volume_data) line2.set_xdata(time_data) line2.set_ydata(sensor_data) @@ -169,6 +170,7 @@ while run: ax2.autoscale_view() plt.draw() plt.pause(0.01) + """ pygame.display.update() diff --git a/test2.py b/test2.py new file mode 100644 index 0000000..f295ffa --- /dev/null +++ b/test2.py @@ -0,0 +1,35 @@ +import pygame +import sys +import math + +SCREEN_WIDTH = 1352 +SCREEN_HEIGHT = 878 + +scale = 1 * pow(10, -8) + +pygame.init() +pygame.display.set_caption("CytoSim") + +screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT), pygame.RESIZABLE) + +while True: + # Event handler for pygame + for event in pygame.event.get(): + if event.type == pygame.QUIT: + pygame.quit() + sys.exit() + if event.type == pygame.VIDEORESIZE: + screen = pygame.display.set_mode((event.w, event.h), pygame.RESIZABLE) + + x, y = screen.get_size() + + screen.fill((0,0,105)) + + pygame.draw.circle(screen, (150,255,10), (x / 2, y /2), 3 * pow(10, -6) / scale) + + pygame.draw.line(screen, (255,255,255), (x - (x * .1), y - (y * .1)), ((x - (x * .1)) - (1 * pow(10, -6) / scale), y - (y * .1))) + + print((1 *pow(10, -6)) / scale) + + pygame.display.update() +