I'm new to Python programming (Windows) and now I have a problem.
I'm trying to print the following:
def volc():
os.system(r'Vol C:')
print(volc)
So, that works as it should: it prints C: drives serial number in console.
But the problem is that I want it to be seen in ListBox. If i try:
def volc():
os.system(r'Vol C:')
Lb1.insert(1, volc)
I get value as "0" in listbox.
What am I doing wrong?
Thanks in advance.
import tkinter as tk
from tkinter import *
import subprocess
from subprocess import check_output
import os
root = tk.Tk()
canvas1 = tk.Canvas(root, width = 300, height = 300)
canvas1.pack()
def volc():
command = "Vol C:"
output = check_output(command.split())
def get_info():
response = messagebox.askokcancel('Please wait... ', 'Accessing current Hard Drive IDs... Please click "OK". ')
if response == True:
Lb1.insert(6, volc)
button1 = tk.Button (root, text='Get all the Hard Drive IDs ',command=get_info,bg='green',fg='white')
canvas1.create_window(150, 200, window=button1)
root.mainloop()
There is a part of it. The rest is not important.