Hi guys,
Im trying to bring up a new window then the Credits button located in the help menu is clicked.
Im trying to run it as a command. So right now, that code doesnt work unless you comment out the creditsCommand region.
So can anyone point me in the right direction to get a new window displayed with text?
#
# File: gui_secondGen_v0.02.pyw
# Programmer: A. Smith
# Created: 20100323
# Edited: 20100504
# Time: 10:01
# Notes:
# 1) Working way down page. Class menu, screen, controls.
#
## ::----:: End Programmer Comments ::----::
## ::----:: Start All Code ::----::
## ::----:: Import Libraries ::----::
try:
# Python2.x
from Tkinter import *
except ImportError:
# Python3.x
import tkinter as tk
## ::----:: End Import ::----::
## ::----:: GUI Main Code::----::
class controlMenu(Frame):
def __init__(self, master=None):
Frame.__init__(self, master, bg='yellow')
self.grid(row=0, column=0)
## ::--:: Define Menu ::--::
self.fileMenu()
self.viewMenu()
self.helpMenu()
## ::--:: End Define Menu ::--::
## ::----:: Menu Code ::----::
def fileMenu(self):
self.mb = Menubutton(self, text="File", relief=RIDGE, font=("Arial", 10))
self.mb.grid(row=0, column=0)
self.mb.menu = Menu(self.mb, tearoff=1)
self.mb["menu"] = self.mb.menu
self.optionVar = IntVar()
self.closeVar = IntVar()
self.mb.menu.add_checkbutton(label="Options", variable=self.optionVar)
self.mb.menu.add_command(label="Close", command=self.quit)
def viewMenu(self):
self.mb = Menubutton(self, text="View", relief=RIDGE, font=("Arial", 10))
self.mb.grid(row=0, column=2)
self.mb.menu = Menu(self.mb, tearoff=1)
self.mb["menu"] = self.mb.menu
self.presetColourVar = IntVar()
self.gridlinesVar = IntVar()
self.size_normVar = IntVar()
self.size_oneVar = IntVar()
self.size_twoVar = IntVar()
self.size_threeVar = IntVar()
self.mb.menu.add_checkbutton(label="Colours", variable=self.presetColourVar)
self.mb.menu.add_checkbutton(label="Grid Lines", variable=self.gridlinesVar)
self.mb.menu.add_checkbutton(label="Size Norm ", variable=self.size_normVar)
self.mb.menu.add_checkbutton(label="Size 1 ", variable=self.size_oneVar)
self.mb.menu.add_checkbutton(label="Size 2 ", variable=self.size_twoVar)
self.mb.menu.add_checkbutton(label="Size 3 ", variable=self.size_threeVar)
def helpMenu(self):
self.mb = Menubutton(self, text="Help", relief=RIDGE, font=("Arial", 10))
self.mb.grid(row=0, column=1)
self.mb.menu = Menu(self.mb, tearoff=1)
self.mb["menu"] = self.mb.menu
self.helpFileVar = IntVar()
self.helpWikiVar = IntVar()
self.creditVar = IntVar()
self.mb.menu.add_checkbutton(label="Help File", variable=self.helpFileVar)
self.mb.menu.add_checkbutton(label="Help Wiki", variable=self.helpWikiVar)
self.mb.menu.add_checkbutton(label="Credits", command=self.creditsCommand) ##variable=self.helpWikiVar)
class creditsCommand():
creditWin = Tk()
creditWin.title("Credit Page")
creditWin.geometry('600x400')
self.creditWords(sticky='nswe')
self.creditVar = IntVar()
self.creditWords = Button(text="This is the credits page", font=("Arial", 10))
# def creditsCommand(self):
# creditWin = Tk()
# creditWin.title("Credit Page")
# creditWin.geometry('600x400')
# #self.creditVar = IntVar()
# creditWin.cWords = Button(text="This is the credits page", font=("Arial", 10))
## ::----:: End Menu Code ::----::
## ::----:: Parent Tk Window ::----::
class Program_Window():
def __init__(self):
self.root = Tk()
self.root.title('Major Project - SDD. secondGen_v0.01')
self.root.geometry('1000x600+140+90')
def menu_Control(self):
controlMenu()
# def (self):
# def (self):
# def (self):
## ::----:: End Parent Tk Window ::----::
## ::----:: Run Program ::----::
mw = Program_Window()
mw.menu_Control()
## ::----:: End Run Program ::----::
## ::----:: End GUI Window Code::----::