Added test to try out new screen
This commit is contained in:
parent
e8f51086d4
commit
41c2aecf88
10
main.py
10
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()
|
||||
|
||||
|
||||
35
test2.py
Normal file
35
test2.py
Normal file
@ -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()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user