Python Forum
Integrating code with gui.py using modular math
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Integrating code with gui.py using modular math
#1
This is above my pay grade but I'm so close to making a working .exe. How do I integrate this code A)=logic with B)=gui): My problem is with the button commands, label and text input output. Please help. thank you

A)
# Software.inc [email protected]
#Mprime hunter Seeker: 2^p-1
#Please input a prime number
#Properties:
#If the middle and last output is 1 then its an Mprime, see (Clause F)
#b)If the middle output is 2, then 1 has to be in the bottom output for Mprime.
#If the top output is Mprime then Mprime
#If the top output is zero no Mprime
#If the middle output is even besides 2 then top has to be prime and bottom has to be 1
#If the middle output is an Mprime then the bottom has to be 1 for it to be Mrime
#If the middle output is 1 and bottom mprime (see Clause 3) then mprime
#Prime (37) is an anomaly other than its 3 outputs is equal to a digital root of 4
#(Clause 3)If the middle output is 1 and bottom 3 and top output equals a 4 in digital root then may not be Mprime
#MPrime (77232917 ) I have a feelings needs to be checked over again
#(Clause F)If you use prime numbers under 101 and  1 and 1 in the middle and bottom outputs then the top output has to be Mprime to be Mprime
# Any zero output may not be prime
while True:

     num = int(input("Enter a Prime; refer to properties, determine Mprime, or 0 to quit: "))
     if num < 0:
        print("Prime numbers only, please!")
        continue
     elif num == 0:
        print("OK, Enough of Mprime Seeking!")
        break
     
     num_mod = num%101 +(num%6^num%12)
     print("{0} is {1}.".format(num, num_mod))
     num_mod = num%7
     print("{0} is {1}.".format(num, num_mod))
     num_mod = num%4
     print("{0} is {1}.".format(num, num_mod))
     
print("All done!")
With B)

#! /usr/bin/env python
#  -*- coding: utf-8 -*-
#
# GUI module generated by PAGE version 4.13
# In conjunction with Tcl version 8.6
#    May 01, 2018 11:41:42 PM

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 Mprimehunter_support

def vp_start_gui():
    '''Starting point when module is the main routine.'''
    global val, w, root
    root = Tk()
    top = New_Toplevel (root)
    Mprimehunter_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)
    Mprimehunter_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("923x657+522+11")
        top.title("New Toplevel")
        top.configure(background="#d9d9d9")



        self.Entry1 = Entry(top)
        self.Entry1.place(relx=0.2, rely=0.06,height=40, relwidth=0.35)
        self.Entry1.configure(background="white")
        self.Entry1.configure(disabledforeground="#a3a3a3")
        self.Entry1.configure(font="TkFixedFont")
        self.Entry1.configure(foreground="#000000")
        self.Entry1.configure(insertbackground="black")
        self.Entry1.configure(width=324)

        self.EnterPrime1 = Label()
        self.EnterPrime1.place(relx=0.02, rely=0.06, height=41, width=144)
        self.EnterPrime1.configure(background="#d9d9d9")
        self.EnterPrime1.configure(disabledforeground="#a3a3a3")
        self.EnterPrime1.configure(foreground="#000000")
        self.EnterPrime1.configure(text='''Enter a Prime Numer''')
        self.EnterPrime1.configure(width=144)

        self.Modular = Button(top)
        self.Modular.place(relx=0.21, rely=0.15, height=34, width=307)
        self.Modular.configure(activebackground="#d9d9d9")
        self.Modular.configure(activeforeground="#000000")
        self.Modular.configure(background="#d9d9d9")
        self.Modular.configure(disabledforeground="#a3a3a3")
        self.Modular.configure(foreground="#000000")
        self.Modular.configure(highlightbackground="#d9d9d9")
        self.Modular.configure(highlightcolor="black")
        self.Modular.configure(pady="0")
        self.Modular.configure(text='''Modular Output''')
        self.Modular.configure(text='''Modular Output''')
        self.Modular.configure(width=307)

        self.tex45 = Text(top)
        self.tex45.place(relx=0.2, rely=0.24, relheight=0.71, relwidth=0.35)
        self.tex45.configure(background="white")
        self.tex45.configure(font="TkTextFont")
        self.tex45.configure(foreground="black")
        self.tex45.configure(highlightbackground="#d9d9d9")
        self.tex45.configure(highlightcolor="black")
        self.tex45.configure(insertbackground="black")
        self.tex45.configure(selectbackground="#c4c4c4")
        self.tex45.configure(selectforeground="black")
        self.tex45.configure(width=324)
        self.tex45.configure(wrap=WORD)

        self.Labelframe1 = LabelFrame(top)
        self.Labelframe1.place(relx=0.57, rely=0.12, relheight=0.81
                , relwidth=0.41)
        self.Labelframe1.configure(relief=GROOVE)
        self.Labelframe1.configure(foreground="black")
        self.Labelframe1.configure(text='''Properties for Mprime Hunter''')
        self.Labelframe1.configure(background="#d9d9d9")
        self.Labelframe1.configure(width=380)

        self.Label1 = Label(self.Labelframe1)
        self.Label1.place(relx=0.05, rely=0.06, height=481, width=334, y=-12)
        self.Label1.configure(background="#d9d9d9")
        self.Label1.configure(disabledforeground="#a3a3a3")
        self.Label1.configure(foreground="#000000")
        self.Label1.configure(text='''# Software.inc [email protected]
    #Mprime hunter Seeker: 2^p-1
    #Please input a prime number
    #Properties:
    #If the middle and last output is 1 then its an Mprime, 
    see (Clause F)
    #b)If the middle output is 2, then 1 has to be in the
     bottom output for Mprime.
    #If the top output is Mprime then Mprime
    #If the top output is zero no Mprime
    #If the middle output is even besides 2 then top has to be 
    prime and bottom has to be 1
    #If the middle output is an Mprime then the bottom has 
    to be 1 for it to be Mrime
    #If the middle output is 1 and bottom mprime 
    (see Clause 3) then mprime
    #Prime (37) is an anomaly other than its 3 outputs is
     equal to a digital root of 4
    #(Clause 3)If the middle output is 1 and bottom 3 and
     top output equals a 4 in digital root then may not be Mprime
    #MPrime (77232917 ) I have a feeling needs to be checked 
    over again
    #(Clause F)If you use prime numbers under 101 and  1 
    and 1 in the middle and bottom outputs then the top output
     has to be Mprime to be Mprime
    # Any zero output may not be prime''')
        self.Label1.configure(width=334)






if __name__ == '__main__':
    vp_start_gui()
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] integrating plot to box zapad 4 180 Apr-15-2024, 09:09 AM
Last Post: SandraYokum
Exclamation Integrating py script onto GUI. edwin4project 0 1,244 Oct-28-2020, 02:20 AM
Last Post: edwin4project
  [PyQt] integrating Pydesigner and python JackDinn 0 2,283 Mar-01-2018, 02:22 PM
Last Post: JackDinn

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020