Jul-28-2020, 11:20 PM
I have a tkinter window, master2.py This window has 14 buttons. Click a button and another window opens. The windows all help me make html for my homework pages, like radio buttons or checkboxes or html tables.
All the functions to make html are in a module guiHTML.py and this works fine, does just what I want.
All the html is saved in a file called "paragraph". When "paragraph" is ready, I click a button in the "master2.py" window called "make the webpage". it asks me a couple of questions, then puts "paragraph" in the html template file. This also works fine.
Because "guiHTML.py" was getting quite long (2674 lines), I thought I would put the function "makeWebpage.py" in another module. I called the module "makeWebpage1.py".
At the top of the master window "master2.py" I have this to import what I need, including my modules "guiHTML" and "makeWebpage1":
If I put the function "makeWebpage()" in the module guiHTML.py and set:
My problem is: the exact same function works from 1 module, but not from the other module!
If I try and call the function "makeWebpage()" from the module "makeWebpage1", nothing happens.
When I call the function "makeWebpage()" from the module "guiHTML" everything works fine.
Stranger still: for testing purposes I define a function "myApp()" for any function I make. I paste the function into Idle and enter myApp(). If there is a problem, I can see where it is and fix it.
When I do that with my master window "master2.py" the function "makeWebpage()" opens fine from the module "makeWebpage1" and works fine!!
I cannot explain this.
Do any of you have a clue why my function "makeWebpage()" works from the module "guiHTML" but not from the module "makeWebpage1"?
Or why both work when I do this in Idle??
Ever had a similar problem??
All the functions to make html are in a module guiHTML.py and this works fine, does just what I want.
All the html is saved in a file called "paragraph". When "paragraph" is ready, I click a button in the "master2.py" window called "make the webpage". it asks me a couple of questions, then puts "paragraph" in the html template file. This also works fine.
Because "guiHTML.py" was getting quite long (2674 lines), I thought I would put the function "makeWebpage.py" in another module. I called the module "makeWebpage1.py".
At the top of the master window "master2.py" I have this to import what I need, including my modules "guiHTML" and "makeWebpage1":
import os, sys # to import the files we need the paths path = '/home/pedro/myPython/myModules/' # append the paths sys.path.append(path) import tkinter as tk from tkinter import * from functools import partial import guiHTML import makeWebpage1In the master2 window I have a function:
def openMakewebpage(): #call the makePage function defined in the makeWebpage1 module makeWebpage1.makeWebpage()and a button:
btn14 = tk.Button(frame1, text='open make webpage', command=openMakewebpage) btn14.grid(columnspan=2, column=0, row=8, sticky='w', pady=10)Strangely, the button does not open the window to make the webpage. All other functions, defined in "guiHTML" work fine.
If I put the function "makeWebpage()" in the module guiHTML.py and set:
def openMakewebpage(): #call the makePage function defined in the guiHTML module guiHTML.makeWebpage()Everything works fine, the function "makeWebpage()" opens normally and does its job!!
My problem is: the exact same function works from 1 module, but not from the other module!
If I try and call the function "makeWebpage()" from the module "makeWebpage1", nothing happens.
When I call the function "makeWebpage()" from the module "guiHTML" everything works fine.
Stranger still: for testing purposes I define a function "myApp()" for any function I make. I paste the function into Idle and enter myApp(). If there is a problem, I can see where it is and fix it.
When I do that with my master window "master2.py" the function "makeWebpage()" opens fine from the module "makeWebpage1" and works fine!!
I cannot explain this.
Do any of you have a clue why my function "makeWebpage()" works from the module "guiHTML" but not from the module "makeWebpage1"?
Or why both work when I do this in Idle??
Ever had a similar problem??