Python Forum
What is the module _support for? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: What is the module _support for? (/thread-10941.html)



What is the module _support for? - Nwb - Jun-14-2018

What does _support do? Is it not an in-built module? How do I get it because my python compiler was not able to import _support.

import _support was part of the script generated by a tkinter gui script generator (PAGE). Has _support's name changed or something? Then what is its new name?

Anyways the line of the code having to do with the module is:
_support.init(root, top)
What is it used for? Is it even necessary?

Thanks. I could not find information about this module, that's why I made this post.

It was not even in the python docs so maybe it's not a built in variable. But then how do I get it, and is it necessary?

How do I install it? And is it even required?


RE: What is the module _support for? - buran - Jun-14-2018

where this code comes from?


RE: What is the module _support for? - Nwb - Jun-14-2018

(Jun-14-2018, 06:41 AM)buran Wrote: where this code comes from?

It was generated from PAGE (tkinter gui code generator).

Full generated code (it's a blank window):

#! /usr/bin/env python
#  -*- coding: utf-8 -*-
#
# GUI module generated by PAGE version 4.14
# In conjunction with Tcl version 8.6
#    Jun 14, 2018 11:56:35 AM

import sys

try:
    from Tkinter import *
except ImportError:
    from tkinter import *

try:
    import ttk
    py3 = False
except ImportError:
    import tkinter.ttk as ttk
    py3 = True

#import _support

def vp_start_gui():
    '''Starting point when module is the main routine.'''
    global val, w, root
    root = Tk()
    top = New_Toplevel (root)
    #_support.init(root, top)
    root.mainloop()

w = None
def create_New_Toplevel(root, *args, **kwargs):
    '''Starting point when module is imported by another program.'''
    global w, w_win, rt
    rt = root
    w = Toplevel (root)
    top = New_Toplevel (w)
    _support.init(w, top, *args, **kwargs)
    return (w, top)

def destroy_New_Toplevel():
    global w
    w.destroy()
    w = None


class New_Toplevel:
    def __init__(self, top=None):
        '''This class configures and populates the toplevel window.
           top is the toplevel containing window.'''
        _bgcolor = '#d9d9d9'  # X11 color: 'gray85'
        _fgcolor = '#000000'  # X11 color: 'black'
        _compcolor = '#d9d9d9' # X11 color: 'gray85'
        _ana1color = '#d9d9d9' # X11 color: 'gray85' 
        _ana2color = '#d9d9d9' # X11 color: 'gray85' 

        top.geometry("600x450+439+125")
        top.title("New Toplevel")
        top.configure(background="#d9d9d9")








if __name__ == '__main__':
    vp_start_gui()



RE: What is the module _support for? - buran - Jun-14-2018

http://page.sourceforge.net/html/modules.html
I didn't use PAGE, but it look like you have some freedom naming that module (i.e. obviously there is some option how to name that support module) - if you look at the examples there are different prefixes used


RE: What is the module _support for? - Nwb - Jun-14-2018

(Jun-14-2018, 07:20 AM)buran Wrote: http://page.sourceforge.net/html/modules.html I didn't use PAGE, but it look like you have some freedom naming that module (i.e. obviously there is some option how to name that support module) - if you look at the examples there are different prefixes used

I didn't understand.. what should I do to the script? When I run it it says that "module _support was not found". How to rename or how to make it work?


RE: What is the module _support for? - buran - Jun-14-2018

As I understand it this is the module where you write your part of the code. This way you can change/regenerate how the GUI looks without changing your own code
Quote:PAGE generates two modules, The GUI module, and the Support Module. The first contains all of the Python code necessary to plop the GUI window onto the computer screen. In my vision of the PAGE word, the GUI module is not to be edited. It contains all of the required linkage to the Support module. It is generally the main module of the application.

Quote:Support Module

This module is home of the hand coded portion of the application. Obviously, PAGE can only prepare a framework for the application. What PAGE knows about are, (1) the linkage between the GUI module and the support module, (2) the callback functions to be located in the Support module, and (3) the Tk variables which are to be manipulated in the support module.

If you look at the docs there are examples like

fnew_support.init(root, top)

also unknown_support:
[Image: console.jpg]

Quote:Python Console

When the user generates Python for either the GUI module or the support module as described above, a separate Python Console window appears with the generated code inside the upper text box. Thus one can see both the GUI module and the support module side by side as of version 4.6.

EDIT: It look like it takes the prefix from the .py file name...


RE: What is the module _support for? - Nwb - Jun-14-2018

(Jun-14-2018, 07:39 AM)buran Wrote: As I understand it this is the module where you write your part of the code. This way you can change/regenerate how the GUI looks without changing your own code
Quote:PAGE generates two modules, The GUI module, and the Support Module. The first contains all of the Python code necessary to plop the GUI window onto the computer screen. In my vision of the PAGE word, the GUI module is not to be edited. It contains all of the required linkage to the Support module. It is generally the main module of the application.
Quote:Support Module This module is home of the hand coded portion of the application. Obviously, PAGE can only prepare a framework for the application. What PAGE knows about are, (1) the linkage between the GUI module and the support module, (2) the callback functions to be located in the Support module, and (3) the Tk variables which are to be manipulated in the support module.
If you look at the docs there are examples like fnew_support.init(root, top) also unknown_support: [Image: console.jpg]
Quote:Python Console When the user generates Python for either the GUI module or the support module as described above, a separate Python Console window appears with the generated code inside the upper text box. Thus one can see both the GUI module and the support module side by side as of version 4.6.
EDIT: It look like it takes the prefix from the .py file name...

So should I remove the import _support and write tkinter_support.init(root, top) for that line?

But,
It says tkinter_support is not defined. Also I can't import tkinter_support (tkinter is file name).

What am I supposed to do?


RE: What is the module _support for? - buran - Jun-14-2018

No! Do you not read what I write?
It is auto named based on your .py file and is generated from PAGE. You just write your code in it.
if your file is nwp.py, the support generated module will be nwp_support


RE: What is the module _support for? - buran - Jun-14-2018

https://youtu.be/oCAWWUhwEUQ?t=5m34s

Under Gen_Python menu there is Generate Support Module (see at 6:00 in the video)


RE: What is the module _support for? - Nwb - Jun-14-2018

(Jun-14-2018, 08:20 AM)buran Wrote: https://youtu.be/oCAWWUhwEUQ?t=5m34s Under Gen_Python menu there is Generate Support Module (see at 6:00 in the video)

Ahh I didn't notice the generate support module lol.. Thanks.