Adding a tutorial option - Tkinter tutorial Python 3.4 part 19

preview_player
Показать описание

In this tkinter how-to tutorial, we cover how to add a tutorial option to our program.

Bitcoin donations: 1GV7srgR4NJx4vrk7avCmmVQQrqmv87ty6
Рекомендации по теме
Комментарии
Автор

The best part is to see the number of views going down as lesson pass. Only motivated people keep working on the app. Great tutorial!

MrHTorre
Автор

great series, Thanks! The way you have the pages (frames) and menus set up, what code would I use to set a menu option press to open a specific page? Thanks.

peterm
Автор

how do you set tkinter window to be always on top in Windows?

Brickkzz
Автор

pretty sure you should only use CamelCase with classes

goodester
Автор

Post your bitcoin or ERC20 address for donations

Hellomynamesolly
Автор

Hi,
I'm using the basic structure in your tutorial for a different project which access a sqlite3 database. Can you think why the following wont work:


class ResultsPage(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
#set logo image at the top of the page

render = ImageTk.PhotoImage(my_logo)
logo=Label(self, image = render)
logo.image=render
logo.grid(row=0, column=1, columnspan=5, pady = 10, padx=10)

my_label=Label(self, text="Results Output File", font=HEADING_FONT)
my_label.grid(row=0, column=6, columnspan=30, padx=20, pady=20, sticky=W)

separator=ttk.Separator(self, orient='horizontal')
separator.grid(row=2, column = 1, sticky=EW, columnspan=20)

#create the link to the database
conn =
#create the cursos
c = conn.cursor()
c.execute("SELECT * FROM kappadata")

items=c.fetchall()
#print (items)
# or can do... and can concantenate "\t" tabs things
rowc = 10

for item in items:
my_label=tk.Label(self, text="Survey Title = %s" % item[0])
my_label.grid(row=int(rowc), column=0, columnspan=15, padx=20, sticky=W)
rowc=rowc+1

my_label=tk.Label(self, text="Question Number: %s" % item[1])
my_label.grid(row=int(rowc), column=0, columnspan=15, padx=20, sticky=W)
rowc=rowc+1

my_label=tk.Label(self, text="Question Text: %s" % item[2])
my_label.grid(row=int(rowc), column=0, columnspan=15, padx=20, sticky=W)
rowc=rowc+1

my_label=tk.Label(self, text="Observed Values array: " + str(item[3][1:-1]))
my_label.grid(row=int(rowc), column=0, columnspan=15, padx=20, sticky=W)
rowc=rowc+1

my_label=tk.Label(self, text="Weights used: " + str(item[4][1:-1]))
my_label.grid(row=int(rowc), column=0, columnspan=15, padx=20, sticky=W)
rowc=rowc+1

my_label=tk.Label(self, text="Expected Values array: " + str(item[5][1:-1]))
my_label.grid(row=int(rowc), column=0, columnspan=15, padx=20, sticky=W)
rowc=rowc+1

my_label=tk.Label(self, text="Weighted-Kappa Result: %s" % item[6])
my_label.grid(row=int(rowc), column=0, columnspan=15, padx=20, sticky=W)
rowc=rowc+1


separator=ttk.Separator(self, orient='horizontal')
separator.grid(row=int(rowc), column = 1, sticky=EW, columnspan=20)

rowc=rowc+1

#commit the command
conn.commit()

#close the connection
conn.close()

peterm