Posts

Showing posts with the label tkinter

printing product headers that have 0 as a value in a separate header GUI

Image
Clash Royale CLAN TAG #URR8PPP printing product headers that have 0 as a value in a separate header GUI For my code, I have to find a certain product and the values associated with it for a specific date( that are headers in the csv file) and take those numbers and manipulate them. However, there are blank values for many of the products ( because those products are not produced for those specific months), thus the reason I produced my current code, because I did not want to display adjusted values for numbers that were either blank or 0. import pandas as pd import csv import numpy as np import os from tkinter import* master = Tk() fileVar = StringVar() fileLabel = Label(master, textvariable=fileVar, font=('Consolas', 9)) fileLabel.grid(row=8, column=1) fileVar2 = StringVar() fileLabel2 = Label(master, textvariable=fileVar2, font=('Consolas', 9)) fileLabel2.grid(row=8, column=2) readfile = pd.read_csv('50.csv') filevalues= readfile.loc[readfile['Custome...

Selecting the folder for performing specific operation on JPG files in tkinter

Image
Clash Royale CLAN TAG #URR8PPP Selecting the folder for performing specific operation on JPG files in tkinter I have written a function for tkinter GUI in python as below: def mgpd(): answer = filedialog.askdirectory(parent=root, initialdir=os.getcwd(), title="Please select a folder:") if len(answer) > 2: with open("output.pdf", "wb") as f: f.write(img2pdf.convert([i for i in os.listdir(answer) if i.endswith(".jpg")])) else: pass t2.delete(0, 'end') t2.insert('insert', 'task completed.') Now when I select a folder the type error is given as TypeError: a bytes-like object is required, not 'str' . The problem is around endswith I guess. TypeError: a bytes-like object is required, not 'str' endswith 2 Answers 2 Python complaining about byt...

I'm trying multiple labels, use Scrollbar. but, I made a mistake

Image
Clash Royale CLAN TAG #URR8PPP I'm trying multiple labels, use Scrollbar. but, I made a mistake from tkinter import * from tkinter import ttk class TestScroll(object): def __init__(self, master): self.master = master # list self.list = Listbox(self.master, height=10) self.list.grid(row=0, column=0, sticky=NSEW) for x in range(50): self.list.insert(END, str(x) + " row...") # scroll self.scroll = Scrollbar(self.master, command=self.list.yview) self.scroll.grid(row=0, column=1, sticky=NSEW) self.list.configure(yscrollcommand=self.scroll.set) class TestScroll2(object): def __init__(self, master): self.master = master # canvas self.canvas = Canvas(self.master, height=200) self.canvas.grid(row=0, column=0) # frame self.frame = Frame(self.canvas) for x in range(50): ttk.Label(self.frame, text='label' + str(x) + ...

How to get an integer value from a 'for' loop in Python and print it

Image
Clash Royale CLAN TAG #URR8PPP How to get an integer value from a 'for' loop in Python and print it I am currently using Canopy to run my code. I was trying to fetch some integer data from the entry box in my GUI according to the number that I give in the for loop and print it. It is not working. for Here is the error: Traceback (most recent call last): File "C:Program FilesEnthoughtCanopyAppappdatacanopy-1.5.5.3123.win- x86_64liblib-tkTkinter.py", line 1532, in __call__ return self.func(*args) File "C:UsersSIMULATORDesktoppythonlife cycle graphtry4.py", line 24, in const z=int(s) ValueError: invalid literal for int() with base 10: '' My code is: from Tkinter import * root = Tk() root.geometry('1000x600+400+400') def const(): const_entries = for i in range(0, 4): en = Entry(root) en.pack() en.place(x=50, y = 200 + 25*i) s = en.get() z = int(s) const_entries.append(z) j = i + 1 ...

How can i give input bengali or Unicode languages in tkinter python

Image
Clash Royale CLAN TAG #URR8PPP How can i give input bengali or Unicode languages in tkinter python I am beginner in GUI platform in python.I tr to Create a text box , but when i input other language except English specially Bengali it shows ??. Can anyone help me out . I attach my code and sample output try: from tkinter import * import sys except ImportError: from tkinter import * import sys class App(object): def __init__(self,parent): self.frame1 = Frame(parent, highlightbackground="green", highlightcolor="#666D00", highlightthickness=7, width=700, height=700, bd= 10) self.frame1.pack() self.frame1.pack_propagate(False) parent.geometry("700x700") parent.resizable(0, 0) self.frame1.configure(background='white') self.text1 = Label(text="আপনার অনুচ্ছেদ পূরণ করুন (বাংলা):",font=("Lohit Bengali", 16)) self.text1.place(x=110, y=100) self.T ...

How can I get the selected value of a combobox (and store it in a variable)?

Image
Clash Royale CLAN TAG #URR8PPP How can I get the selected value of a combobox (and store it in a variable)? I've been wondering how can I get the current value of a combobox (not the current()) and preferably store it to my variable 'listvalue'. I've been searching for a while but never found anything that I wanted. Here's the sample code: FontList1['values'] = ("Courier","Courier New","Times New Roman","Comic Sans MS") FontList1.set(TypeFace) print(listvalue) FontList1.pack(side="right") By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.