Skip to content

Commit a904957

Browse files
committed
Centered Greet Label
1 parent f693f40 commit a904957

File tree

3 files changed

+15
-20
lines changed

3 files changed

+15
-20
lines changed

CPU_Scheduler/NonPreemptivePriorityScheduling.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
from time import sleep
55
from os import system
66

7-
8-
97
console = Console()
108

119
# This is a Non-Preemtive Priotity Scheduling Program
@@ -38,10 +36,9 @@ def Random_Input(self, Num_Process, Max_Burst):
3836

3937
while True:
4038
arrivalTime = randint(0, randomizer_limit)
41-
4239
if [_process for _process in self.processList if _process[1] == arrivalTime]:
4340
pass
44-
else:
41+
else:
4542
break
4643

4744
burstTime = randint(1, Max_Burst)
Binary file not shown.

CPU_Scheduler/main.py

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,27 @@
77
from tkinter import ttk
88
from PIL import Image, ImageTk
99

10-
11-
1210
class ToplevelWindow(customtkinter.CTkToplevel):
1311
def __init__(self, *args, **kwargs):
1412
super().__init__(*args, **kwargs)
1513
self.geometry("1000x500")
1614
self.grid_columnconfigure((0, 1), weight=1)
1715
self.grid_rowconfigure(0, weight=1)
1816

19-
# self.fig, self.ax = plt.subplots()
20-
# self.table = self.ax.table(cellText=self.values, loc='center', cellLoc='center')
21-
# self.ax.axis("off")
22-
# self.table.auto_set_font_size(False)
23-
# self.table.set_fontsize(12)
24-
# self.table.scale(1, 1.5)
25-
# plt.savefig("output\Processtable.png")
17+
self.fig, self.ax = plt.subplots()
18+
self.table = self.ax.table(cellText=self.values, loc='center', cellLoc='center')
19+
self.ax.axis("off")
20+
self.table.auto_set_font_size(False)
21+
self.table.set_fontsize(12)
22+
self.table.scale(1, 1.5)
23+
plt.savefig("table.png")
2624

2725

2826
self.myimg = customtkinter.CTkImage(Image.open("table.png"), size=(400, 400))
2927
self.imgLabel = customtkinter.CTkLabel(self, image=self.myimg, text="")
3028
self.imgLabel.grid(row=0, column=0, sticky="nsew")
3129

32-
self._myimg = customtkinter.CTkImage(Image.open("output/Processtable.png"), size=(400, 400))
33-
self._imgLabel = customtkinter.CTkLabel(self, image=self._myimg, text="")
34-
self._imgLabel.grid(row=0, column=1, sticky="nsew")
35-
30+
3631

3732
# class PlotWindow(customtkinter.CTkFrame):
3833
# def __init__(self, master):
@@ -105,13 +100,12 @@ def setAlgo(self, choice):
105100
return choice
106101

107102
def startExecution(self):
108-
109103
if self.AlgoMenu.get() == "Preemptive Priority Scheduling":
110104
print("This is Preemptive Priority Scheduling")
111105
elif self.AlgoMenu.get() == "Non-Preemtive Priotity Scheduling":
112106

113107
self.toplev = ToplevelWindow(self)
114-
# self.processList = self.NonPPS_Instance.Random_Input(int(self.Process_Input.get()), math.trunc(self.Burst_Time.get()))
108+
self.processList = self.NonPPS_Instance.Random_Input(int(self.Process_Input.get()), math.trunc(self.Burst_Time.get()))
115109
# self.Plot_Window.DrawTable(int(self.Process_Input.get()))
116110
# self.TopWin = ToplevelWindow(self)
117111
# self.myimg = customtkinter.CTkImage(light_image=Image.open("table.png"), size=(100,100))
@@ -125,10 +119,14 @@ def __init__(self):
125119
super().__init__()
126120

127121
self.title("CPU Scheduler Algorithm")
128-
self.geometry("1000x500");
122+
self.geometry("1000x300");
129123
self.grid_columnconfigure(0, weight=1)
130124
self.grid_rowconfigure(0, weight=1)
131125

126+
## Welcome Label
127+
self.greet = customtkinter.CTkLabel(self, text="CPU Algorithm Simulator", fg_color="transparent")
128+
self.greet.grid(row=0, column=0, sticky="nsew")
129+
132130
### OPTION MENU
133131
self.optionMenu = OptionWindow(self)
134132
self.optionMenu.grid(row=1, column=0, sticky="ew", columnspan=2, padx=50, pady=10)

0 commit comments

Comments
 (0)