#! /usr/bin/env python
#  -*- coding: utf-8 -*-
#
# Support module generated by PAGE version 7m
#  in conjunction with Tcl version 8.6
#    Aug 08, 2021 09:36:03 PM PDT  platform: Linux

import sys
import tkinter as tk
import tkinter.ttk as ttk
from tkinter.constants import *

import cpu_info
import subprocess

def main(*args):
    '''Main entry point for the application.'''
    global root
    root = tk.Tk()
    root.protocol( 'WM_DELETE_WINDOW' , root.destroy)
    # Creates a toplevel widget.
    global _top34, _w34
    _top34 = root
    _w34 = cpu_info.Toplevel1(_top34)
    init(_top34, _w34)    
    root.mainloop()

def init(top, gui, *args, **kwargs):
    global w, top_level, root
    w = gui
    top_level = top
    root = top
    load_cpu_info()

def load_cpu_info():
    global w
    obj = w.Scrolledtext1
    obj.delete(1.0, END)
    proc = subprocess.Popen('lscpu', stdout=subprocess.PIPE, shell=True)
    (out, err) = proc.communicate()
    obj.insert(END, out)

def init(top, gui, *args, **kwargs):
    global w, top_level, root
    w = gui
    top_level = top
    root = top
    load_cpu_info()

def load_cpu_info():
    global w
    obj = w.Scrolledtext1
    obj.delete(1.0, END)
    proc = subprocess.Popen('lscpu', stdout=subprocess.PIPE, shell=True)
    (out, err) = proc.communicate()
    obj.insert(END, out)

def quit():
    print('cpu_info_support.quit')
    sys.stdout.flush()
    sys.exit()

if __name__ == '__main__':
    cpu_info.start_up()




