Skip to content

Instantly share code, notes, and snippets.

View zaxboy24's full-sized avatar
🎯
Focusing

Shao D Vorgz zaxboy24

🎯
Focusing
  • Gefura Inc.
View GitHub Profile
@zaxboy24
zaxboy24 / bankers_algorithm.py
Created December 4, 2019 10:34 — forked from aasmpro/bankers_algorithm.py
Python implementation of Banker's algorithm, written in Python 3
def main():
processes = int(input("number of processes : "))
resources = int(input("number of resources : "))
max_resources = [int(i) for i in input("maximum resources : ").split()]
print("\n-- allocated resources for each process --")
currently_allocated = [[int(i) for i in input(f"process {j + 1} : ").split()] for j in range(processes)]
print("\n-- maximum resources for each process --")
max_need = [[int(i) for i in input(f"process {j + 1} : ").split()] for j in range(processes)]
@zaxboy24
zaxboy24 / bankers_algorithm.py
Created December 4, 2019 10:34 — forked from aasmpro/bankers_algorithm.py
Python implementation of Banker's algorithm, written in Python 3
def main():
processes = int(input("number of processes : "))
resources = int(input("number of resources : "))
max_resources = [int(i) for i in input("maximum resources : ").split()]
print("\n-- allocated resources for each process --")
currently_allocated = [[int(i) for i in input(f"process {j + 1} : ").split()] for j in range(processes)]
print("\n-- maximum resources for each process --")
max_need = [[int(i) for i in input(f"process {j + 1} : ").split()] for j in range(processes)]
@zaxboy24
zaxboy24 / gist:963035ca28ae4a631bb4fcd29f8794e7
Created January 31, 2019 12:34
How to call the child window using parent method in tkinter? Can anyone help me please.
import tkinter as tk
import tkMessageBox
import ttk
class Track(tk.Frame):
def __init__(self, master):
tk.Frame.__init__(self, master)
x = (self.master.winfo_screenwidth() - self.master.winfo_reqwidth()) / 2
y = (self.master.winfo_screenheight() - self.master.winfo_reqheight()) / 2