razstec 31 Junior Poster in Training

i need to get all attachments from a jira issue.

done this so far

from jira import JIRA

issues = jira.search_issues(search_query, start, size)
    for issue in issues:
        con_tot += 1
        comentaut = ""
        comentdate = ""
        comentmsg = ""
        lst_img=[]
        for x in jira.comments(issue.key):
            comentdate = x.created
            comentmsg = x.body
            pth = 'https://cloud.atlassian.net/browse/' + str(issue) + '/'
            a = comentmsg.split('|width')
            af = a[0].replace('!','')
            path2img = pth+af
            lst_img.append(path2img)
            comentaut = x.author.displayName

unfortunatly this is not work, the link it generates dont seem to point anywhere. this is what im getting

https://cloud.atlassian.net/browse/CSV-2443/Captura%20de%20ecr%C3%A3%202022-09-21%20160636.png

Anyone knows how to build the direct link to the image?

thanks in advance

Tried

attach_list = issue.fields.attachment
print(attach_list)

but i get

AttributeError: 'PropertyHolder' object has no attribute 'attachment'

razstec 31 Junior Poster in Training

Im very new to flask and im trying to convert a python tkinter gui app to web. As you can understand i have all the functions made so it would be great if a could call them and pass variables with a single click of a button.

for example:

get_sub_menu is a list generated by a query to the db where it stores [('1','name1'),('2','name2'),('3','name3')]

mod[0] = id

mod[1] = name

html file:

<html><head></head><body>

{% for mod in get_sub_menu %}
<button type="submit">{{ mod[1] }}</button>
{% endfor %}

<!--
when i click in one button he should submit the id(mod[0]) and call function(myid) where myid would be the id submited 
when the button is clicked in order to generate the second list of buttons.
-->

{% for item in function(mod[0]) %}
<button type="submit">{{ item[1] }}</button> #function(mod[0])
{% endfor %}

</body><html>

py file:

def function(myid):

    select * from table where id=myid

    res = cursor.fetchall()

    return res 

should i do this with request or args? can anyone help me with bouth questions in order for me to learn and understand why one is better than the other?

razstec 31 Junior Poster in Training

got it y_url = item.watchv_url

now i get AttributeError: 'YtdlStream' object has no attribute 'y_url' in line 80
player = vlc.MediaPlayer(best.y_url.strip())

razstec 31 Junior Poster in Training

i add them to a list but the list add them like this: [Pafy object: w0N4twV28Mw [Ini Kamoze - Here Comes The Hotstepper (HQ)..]] how do i just get the w0N4twV28Mw?

razstec 31 Junior Poster in Training

it apears in line items = playlist["items"]# getting playlist items

rproffitt commented: I don't work hard at this. Asking for line number from above so I don't have find it. +16
Schol-R-LEA commented: So, line 71. Please say so in the future. +15
razstec 31 Junior Poster in Training

fix the quota with youtube api key, now i get
TypeError: '<' not supported between instances of 'str' and 'int'
in line items = playlist["items"]# getting playlist items

razstec 31 Junior Poster in Training

Hi, im trying to set a radio and youtube playlist player

my code works with radio and single youtube link but with playlist it says that the link is unrecognized, can somoene help?

import os
from os import path
from random import randrange
from tkinter.ttk import Combobox
import pafy
import requests
import vlc
import time
from tkinter import *
from tkinter import messagebox,PhotoImage

from bs4 import BeautifulSoup

root = Tk()

global phplay,phpause,phstop
global pausevar
pausevar = ""
phplay = PhotoImage(file=r'img/play.png')
phpause = PhotoImage(file=r'img/pause.png')
phstop = PhotoImage(file=r'img/stop.png')


frmradio = LabelFrame(root, text="Radio Player", padx=5, pady=5, highlightbackground="black", highlightthickness=2)
frmradio.grid(row=0, column=0, sticky=NW, pady=2)



def getradiolist():
    var1 = open("Confs/lstradios.txt", "r").readlines()
    data = []

    for line in var1:
        if len(line) > 1:
            estacao, url, = line.split('<=>')
            data.append(estacao)
    return data

valradio = StringVar()
imp_radio = Combobox(frmradio, textvariable=valradio, height=10, width=47)
imp_radio['values'] = getradiolist()
imp_radio['state'] = 'readonly'
imp_radio.grid(row=1, column=0,columnspan=5, pady=2, sticky="ew")

# define VLC instance
instance = vlc.Instance('--input-repeat=-1', '--fullscreen')
# Define VLC player
player = instance.media_player_new()
instance.log_unset()


def startplayer(pausevar):
    if pausevar == "sim":
        pausevar=""
        player.pause()


    player.stop()
    esta = imp_radio.get()
    if len(esta)>1:
        var1 = open("Confs/lstradios.txt", "r").readlines()
        for line in var1:
            if len(line) > 1:
                if esta in line:
                    estacao, url, = line.split('<=>')
                    break

        if "youtube" in estacao:
            print(url)
            playlist = pafy.get_playlist2(url.strip())
            items = playlist["items"]# getting playlist items

            def loop_play():
                item = items[randrange(len(items))]
                i_pafy = item['pafy']
                y_url = i_pafy.watchv_url
                video = pafy.new(y_url)
                best = video.getbest()

                media = instance.media_new(best.y_url.strip())
                player.set_media(media)
                frmradio.config(text=str(item["title"]))
                player.play()

            loop_play()
        else:
            media = instance.media_new(url.strip())
            player.set_media(media)
            player.play()


        frmradio.config(text=str("Radio Player : Playing: " + estacao))


def stopplauyer():
    player.stop()
    frmradio.config(text=str("Radio Player"))

def …
razstec 31 Junior Poster in Training

Now its pointing right and opening with the specified dimensions, but it still not opening in the correct place although self is pointing to the correct frame

    import ctypes
    import platform
    from cefpython3 import cefpython as cef
    from tkinter import *
    import tkinter as tk
    import sys
    from cefpython.examples.tkinter_ import logger


    WINDOWS = platform.system() == 'Windows'
    LINUX = platform.system() == 'Linux'
    MAC = platform.system() == 'Darwin'

    class BrowserFrame(tk.LabelFrame):
        def __init__(self, master=None, **kw):
            super().__init__(master, text='Browser', **kw)
            self.browser = None
            self.bind('<Configure>', self.on_configure)

        def winfo_id(self):
            return super.winfo_id()

        def get_window_handle(self):
            if MAC:
                from AppKit import NSApp
                import objc
                return objc.pyobjc_id(NSApp.windows()[-1].contentView())
            elif self.winfo_id() > 0:
                return self.winfo_id()
            else:
                raise Exception('Could not obtain window handle!')

        def cef_loop(self):
            cef.MessageLoopWork()
            self.after(10, self.cef_loop)


        def on_configure(self, event):
            if self.browser is None:
                # create the browser and embed it in current frame
                self.update()
                rect = [0, 0, 500, 450]
                cef_winfo = cef.WindowInfo()
                win_id = self.get_window_handle()
                cef_winfo.SetAsChild(win_id, rect)
                self.browser = cef.CreateBrowserSync(cef_winfo, url=urlset)


                print("self: ",self)
                print("rect: ",rect)
                print("win_id: ",win_id)
                print("self.winfo_width(), self.winfo_height(): ",self.winfo_width(), self.winfo_height())
                print("self.browser: ",self.browser)
                print("cef_winfo: ",cef_winfo)

                # start the browser handling loop
                self.cef_loop()

            # resize the browser
            if WINDOWS:
                ctypes.windll.user32.SetWindowPos(
                    self.browser.GetWindowHandle(), 0,
                    0, 0, event.width, event.height, 0x0002)
            elif LINUX:
                self.browser.SetBounds(0, 0, event.width, event.height)




    def main():
        root = tk.Tk()
        root.columnconfigure(0, weight=1)
        root.columnconfigure(1, weight=2)
        root.rowconfigure(0, weight=1)
        w, h = root.winfo_screenwidth(), root.winfo_screenheight()
        root.geometry("%dx%d+0+0" % (w-250, h-300))
        root.title('Test')


        WindowUtils = cef.WindowUtils()
        sys.excepthook = cef.ExceptHook  # To shutdown all CEF processes on error
        settings = {}
        if MAC:
            settings["external_message_pump"] = True

        cef.Initialize(settings=settings)


        leftfrm = tk.LabelFrame(root, text="Left", padx=5, pady=5, bg='red')
        leftfrm.grid(row=0, column=0, sticky='news', pady=2)

        home_browser = tk.LabelFrame(root, …
razstec 31 Junior Poster in Training

i think the issue is here

rect = [0, 0, self.winfo_width(), self.winfo_height()]

it prints

140339762794416 [0, 0, 1, 1]

i think its because the browser windows is not set properly, the self points to .!labelframe2.!browserframe

if i replace

rect = [0, 0, self.winfo_width(), self.winfo_height()]
for
rect = [0, 0, 300,200]

it opens, so the issue is that the browser frame is set to 0,0

also, doing this opens but not in the correct LabelFrame(home_browser)

also this might help

print(win_id, rect) -> 140276467161232 [5, 5, 1, 1]
print(self) -> .!labelframe2.!browserframe
print(cef_winfo) -> <cefpython_py39.WindowInfo object at 0x7f94ac924220>
print(event) -> <Configure event x=9 y=25 width=1 height=1>

razstec 31 Junior Poster in Training

Hi, i have this script but cant seem to open the browserframe in the correct place

Captura_de_ecrã_2021-10-25,_às_11_07_07.png

import ctypes
import platform
from cefpython3 import cefpython as cef
from tkinter import *
import tkinter as tk
import sys

# platforms
WINDOWS = platform.system() == 'Windows'
LINUX = platform.system() == 'Linux'
MAC = platform.system() == 'Darwin'


class BrowserFrame(tk.Frame):
    def __init__(self, master=None, **kw):
        super().__init__(master, **kw)
        self.browser = None
        self.bind('<Configure>', self.on_configure)

    def get_window_handle(self):
        if MAC:
            from AppKit import NSApp
            import objc
            return objc.pyobjc_id(NSApp.windows()[-1].contentView())
        elif self.winfo_id() > 0:
            return self.winfo_id()
        else:
            raise Exception('Could not obtain window handle!')

    def on_configure(self, event):
        if self.browser is None:
            # create the browser and embed it in current frame
            rect = [0, 0, self.winfo_width(), self.winfo_height()]
            cef_winfo = cef.WindowInfo()
            win_id = self.get_window_handle()
            cef_winfo.SetAsChild(win_id, rect)
            self.browser = cef.CreateBrowserSync(cef_winfo, url=urlset)

            # start the browser handling loop
            self.cef_loop()

        # resize the browser
        if WINDOWS:
            ctypes.windll.user32.SetWindowPos(
                self.browser.GetWindowHandle(), 0,
                0, 0, event.width, event.height, 0x0002)
        elif LINUX:
            self.browser.SetBounds(0, 0, event.width, event.height)

    def cef_loop(self):
        cef.MessageLoopWork()
        self.after(10, self.cef_loop)


def main():
    sys.excepthook = cef.ExceptHook  # To shutdown all CEF processes on error

    root = tk.Tk()
    root.minsize(600, 600)
    w, h = root.winfo_screenwidth(), root.winfo_screenheight()
    root.geometry("%dx%d+0+0" % (w-550, h-250))
    root.title('Test')

    settings = {}
    if MAC:
        settings["external_message_pump"] = True

    cef.Initialize(settings=settings)

    leftfrm = LabelFrame(root, text="left frame for buttons with links", padx=5, pady=5, highlightbackground="black", highlightthickness=2)
    leftfrm.grid(row=0, column=0, rowspan=99, sticky='nw', pady=2)

    home_browser = LabelFrame(root, text="right frame for browser", padx=5, pady=5, highlightbackground="black", highlightthickness=2)
    home_browser.grid(row=0, column=1, rowspan=99, sticky='ne', pady=2)

    BrowserFrame(home_browser).grid(row=2, column=0, columnspan=9, sticky="ne")

    for x in range(1, 25):
        Label(leftfrm, text=str("Link "+str(x))).grid(row=x,column=0)

    global urlset
    urlset = "http://www.google.com"

    root.mainloop() …
razstec 31 Junior Poster in Training

i stated the tag openpyxl, and the example is a full example to add borders to cell. i havent explain much because the tag and code can only be one thing, but ill try to give a better explanation.

Using openpyxl im trying to set borders to my excell spreedsheet, this is what iv got so far

thick = Side(border_style="thick", color='FF0707')
        ws['F1'].border = Border(top=thick, left=thick, right=thick, bottom=thick)
        for row in ws['A1:D10']:
            for cell in row:
                cell.border = Border(top=thick, left=thick, right=thick, bottom=thick)

this is the part of my code where i create the file

      wb = openpyxl.Workbook()
      ws = wb.active
      wb.create_sheet("General Form")
      ws = wb['General Form'] 

      thick = Side(border_style="thick", color='FF0707')
            ws['F1'].border = Border(top=thick, left=thick, right=thick, bottom=thick)
            for row in ws['A1:D10']:
                for cell in row:
                    cell.border = Border(top=thick, left=thick, right=thick, bottom=thick)


  wb.save(os.path.join('Reports', filename_report))
razstec 31 Junior Poster in Training

iv got it with

xlsx['Sheet']['A1'].fill = PatternFill(start_color='FF001F', end_color='FF001F',fill_type = 'solid')
razstec 31 Junior Poster in Training

i have this line to set the background color of a cell but instead of the color i specified it set the cell to black.

Tried with diferent colors to check and it always set it to black.

why is that and how to fix it?

ws['A1'].fill = PatternFill(fgColor="7FFFD4", fill_type="solid")
ws['A1'].fill = PatternFill(start_color="8a2be2", end_color="8a2be2", fill_type="solid")
ws['A1'].fill = PatternFill(start_color="8a2be2", fill_type="solid")
ws['A1'].fill = PatternFill(bgColor="7FFFD4", fill_type="solid")
razstec 31 Junior Poster in Training

Anyone know why this is not adding borders to my sheet?

        thick = Side(border_style="thick", color='FF0707')
        ws['F1'].border = Border(top=thick, left=thick, right=thick, bottom=thick)
        for row in ws['A1:D10']:
            for cell in row:
                cell.border = Border(top=thick, left=thick, right=thick, bottom=thick)
razstec 31 Junior Poster in Training

cant edit :(. this is the correct example

from tkinter import ttk, Tk

root = Tk()

global gen_reprow,x
gen_reprow=8
x=0

mainframe = ttk.Frame(root)
mainframe.grid(column=0, row=0)

def printd(gena):
    print(gena)


def ger_but(vv):
    for x in range(vv):
        ttk.Button(mainframe, width="15", text=x, command=lambda gen=gen_reprow: printd(gen)).grid(column=0, row=x, padx=1, pady=15)
        x += 1
        gen_reprow += 1



ger_but(9) # this needs to print 8 to 15
ger_but(5) # this needs to print 16 to 19

if __name__ == "__main__":
    root.mainloop()
razstec 31 Junior Poster in Training

Hi have this loop but insted of send the correct value in the button it always send the original value
this creates the buttons named from 0 to 9, but when i run the button it always prints 8 insted of 8,9,10 etc...

from tkinter import *
from tkinter import ttk

root = Tk()

global gen_reprow,x
gen_reprow=8
x=0

mainframe = ttk.Frame(root, padding="3 3 12 12")
mainframe.grid(column=0, row=0, sticky=(N, W, E, S))

def printd(gena):
    print(gena)


def ger_but():
    for x in range(10):
       ttk.Button(mainframe, width="15", text=x,command=lambda gen=gen_reprow: printd(gen)).grid(column=0, row=x, padx=1, pady=15)
        x += 1
        gen_reprow += 1



ger_but()
if __name__ == "__main__":
    root.mainloop()
razstec 31 Junior Poster in Training

made some changes

its still confusing :s

you need to manually resize the window for the browser to show.... dont ask me why :(

# Example of embedding CEF Python browser using Tkinter toolkit.
# This example has two widgets: a navigation bar and a browser.
#
# NOTE: This example often crashes on Mac (Python 2.7, Tk 8.5/8.6)
#       during initial app loading with such message:
#       "Segmentation fault: 11". Reported as Issue #309.
#
# Tested configurations:
# - Tk 8.5 on Windows/Mac
# - Tk 8.6 on Linux
# - CEF Python v55.3+
#
# Known issue on Linux: When typing url, mouse must be over url
# entry widget otherwise keyboard focus is lost (Issue #255
# and Issue #284).
# Other focus issues discussed in Issue #535.
from tkinter import ttk
from tkinter.scrolledtext import ScrolledText

from cefpython3 import cefpython as cef
import ctypes

try:
    import tkinter as tk
except ImportError:
    import Tkinter as tk
import sys
import os
import platform
import logging as _logging

# Fix for PyCharm hints warnings
WindowUtils = cef.WindowUtils()

# Platforms
WINDOWS = (platform.system() == "Windows")
LINUX = (platform.system() == "Linux")
MAC = (platform.system() == "Darwin")

# Globals
logger = _logging.getLogger("tkinter_.py")

# Constants
# Tk 8.5 doesn't support png images
IMAGE_EXT = ".png" if tk.TkVersion > 8.5 else ".gif"

def seturl(uurl):
    url = uurl
seturl("www.google.com")

def main():
    logger.setLevel(_logging.DEBUG)
    stream_handler = _logging.StreamHandler()
    formatter = _logging.Formatter("[%(filename)s] %(message)s")
    stream_handler.setFormatter(formatter)
    logger.addHandler(stream_handler)
    logger.info("CEF Python {ver}".format(ver=cef.__version__))
    logger.info("Python {ver} {arch}".format(ver=platform.python_version(), arch=platform.architecture()[0]))
    logger.info("Tk {ver}".format(ver=tk.Tcl().eval('info patchlevel')))
    assert cef.__version__ >= "55.3", …
razstec 31 Junior Poster in Training

this is complicated :s do you think i can clean this code? i think there many features that are not even implemented yet :s

# Example of embedding CEF Python browser using Tkinter toolkit.
# This example has two widgets: a navigation bar and a browser.
#
# NOTE: This example often crashes on Mac (Python 2.7, Tk 8.5/8.6)
#       during initial app loading with such message:
#       "Segmentation fault: 11". Reported as Issue #309.
#
# Tested configurations:
# - Tk 8.5 on Windows/Mac
# - Tk 8.6 on Linux
# - CEF Python v55.3+
#
# Known issue on Linux: When typing url, mouse must be over url
# entry widget otherwise keyboard focus is lost (Issue #255
# and Issue #284).
# Other focus issues discussed in Issue #535.
from tkinter import ttk
from tkinter.scrolledtext import ScrolledText

from cefpython3 import cefpython as cef
import ctypes

try:
    import tkinter as tk
except ImportError:
    import Tkinter as tk
import sys
import os
import platform
import logging as _logging

# Fix for PyCharm hints warnings
WindowUtils = cef.WindowUtils()

# Platforms
WINDOWS = (platform.system() == "Windows")
LINUX = (platform.system() == "Linux")
MAC = (platform.system() == "Darwin")

# Globals
logger = _logging.getLogger("tkinter_.py")

# Constants
# Tk 8.5 doesn't support png images
IMAGE_EXT = ".png" if tk.TkVersion > 8.5 else ".gif"


def main():
    logger.setLevel(_logging.DEBUG)
    stream_handler = _logging.StreamHandler()
    formatter = _logging.Formatter("[%(filename)s] %(message)s")
    stream_handler.setFormatter(formatter)
    logger.addHandler(stream_handler)
    logger.info("CEF Python {ver}".format(ver=cef.__version__))
    logger.info("Python {ver} {arch}".format(
        ver=platform.python_version(), arch=platform.architecture()[0]))
    logger.info("Tk {ver}".format(ver=tk.Tcl().eval('info patchlevel')))
    assert cef.__version__ >= "55.3", "CEF Python v55.3+ required to …
razstec 31 Junior Poster in Training

this is what i need, maybe its easier like this

Captura_de_ecrã_2021-08-25,_às_09_29_24.png

this seems to work
https://github.com/cztomczak/cefpython/blob/master/examples/tkinter_.py
or
https://pythonprogramming.altervista.org/python-goes-to-the-web-cefpython-and-tkinter/
but i get this error on booth

raise Exception("Python version not supported: " + sys.version)
Exception: Python version not supported: 3.9.4 (v3.9.4:1f2e3088f3, Apr  4 2021, 12:32:44) 
[Clang 6.0 (clang-600.0.57)]

i think cefpython3 dont work with python 3.9

razstec 31 Junior Poster in Training

hi, sorry to bother you, been trying the past weeks, is there a way this can be done? im starting to think that it cant be done :(

can you just point me in the right way, im always looking in dead ends :s

thanks

razstec 31 Junior Poster in Training

no one is ever happy at first :( now i need to add more projects but in the charts i will only use two, "operations" and all the others inside the name "others"

been trying with an if but its not working :s

if "Operations" not in tipo:
    tipo="Others"

if tipo not in issue_types:
    issue_types.append(tipo)

Can you help?
thanks

razstec 31 Junior Poster in Training

hi, it doesnt need to be qt, i just cant find a way to do this with tkinter.

the thing is when ever i click a button the browser frame would reload, it will always be the same site but with diferent parameters for logtrail search.

razstec 31 Junior Poster in Training

Got this to open a browser inside a specific frame, and i need it to be changeable, any ideas?

been readin pyqt5 but cant seem to manage this

import sys
from tkinter import Tk, ttk
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtWebEngineWidgets import *

mainwind = Tk()
w, h = mainwind.winfo_screenwidth(), mainwind.winfo_screenheight()
mainwind.geometry("%dx%d+0+0" % (w, h))
mainwind.title("browser")

url = "https://www.google.com"
def seturl(urlbtn):
    url = urlbtn




class MainWindow(QMainWindow):
    def __init__(self):
        super(MainWindow, self).__init__()
        self.browser = QWebEngineView()
        self.browser.setUrl(QUrl(url))
        self.setCentralWidget(self.browser)
        self.showNormal()

        # navbar
        navbar = QToolBar()
        self.addToolBar(navbar)

        home_btn = QAction('Home', self)
        home_btn.triggered.connect(self.navigate_home)
        navbar.addAction(home_btn)

        self.url_bar = QLineEdit()
        self.url_bar.returnPressed.connect(self.navigate_to_url)
        navbar.addWidget(self.url_bar)

        self.browser.urlChanged.connect(self.update_url)

    def navigate_home(self):
        self.browser.setUrl(QUrl(url))

    def navigate_to_url(self):
        url = self.url_bar.text()
        self.browser.setUrl(QUrl(url))

    def update_url(self, q):
        self.url_bar.setText(q.toString())




frm_window_left = ttk.Frame(mainwind)
frm_window_left.grid(column=0, row=0, rowspan=99)

frm_browser = ttk.Frame(mainwind)
frm_browser.grid(column=1, row=0, rowspan=99)

frm_window_right = ttk.Frame(mainwind)
frm_window_right.grid(column=2, row=0, rowspan=99)



ttk.Label(frm_window_left, text=":::::::::::::left:::::::::::::").grid(column=0, row=0, padx=10, pady=10)
ttk.Button(frm_window_left, text="url1_L", command=seturl("https://outlook.com/")).grid(column=0, row=1, padx=10,pady=10, ipady=35)
ttk.Button(frm_window_left, text="url2_L", command=seturl("https://www.Facebook.com")).grid(column=0, row=2, padx=10,pady=10, ipady=35)

ttk.Label(frm_browser, text="............................Browser Window Open Here................................\n\n\n\n\n\n\n\n\a").grid(column=0, row=0, padx=10, pady=10)


ttk.Label(frm_window_right, text=":::::::::::::right:::::::::::::").grid(column=0, row=0, padx=10, pady=10)
ttk.Button(frm_window_right, text="url1_R", command=seturl("https://www.google.com/")).grid(column=0, row=1, padx=10,pady=10, ipady=35)
ttk.Button(frm_window_right, text="url2_R", command=seturl("https://www.daniweb.com/")).grid(column=0, row=2, padx=10,pady=10, ipady=35)



app = QApplication(sys.argv)
window = MainWindow()
app.exec_()

thanks

razstec 31 Junior Poster in Training

that only give the total, printed labels and it return all 3, but when applying to chart it only displays the first(Total)

added this

 for i in range(len(issue_details)):
        bars = axes.bar(range(len(issue_details.keys())), data, width=bar_width, color=colorset, label=labels[i])

and now it shows the legends but all in gray :s

tried to change color=colorset to color=colorset[i] and the legends color was right but the bars in the chart get all orange :s

fix the colors, dont ask me why but changed to more specific names and its ok now
colorset = ['SteelBlue', 'DarkOrange',

razstec 31 Junior Poster in Training

Wow thats is great, thank you so much.

had to make some changes but its working great.

Just two things, how can i had the subtitle to the first chart?

why are the colors diferent? iv check the code and its same but as you can see bellow the blue and orange are diferent ? :s

AAaaaaaaaa.png

razstec 31 Junior Poster in Training

although that didnt work either the thing is that its not needed since what i need is current month, last month, total since the begining of the year and monthly from the begining of the year(you can see last week example bellow).

tipo = issue.fields.project.name.strip() existe because there are two option Operations and Product

i need it to make the distincion between project.name

something like this

    if "Operations" in str(issue.fields.project.name):
                tipo_operation += 1
            elif "Product Development" in str(issue.fields.project.name):

            tipo_product_development += 1

the problem im facing is spliting the month in weeks

also i need to generate all 4 graphic together like the picture bellow, cant see if that is possible :s

este.png

thank you for all the time you been helping me out, really apreciate it

razstec 31 Junior Poster in Training

strange, same error

 File "/Users/ricardosimoes/PycharmProjects/OCPP/week_report.py", line 117, in get_chart
    data[week_number_of_month(issue_date) - 1] += 1

IndexError: list index out of range
razstec 31 Junior Poster in Training

it reply this :s

/usr/local/bin/python3.9 /Users/ricardosimoes/PycharmProjects/OCPP/week_report.py
4
4
4
4
4
4
4
4
4
4
4
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
1
1
1
1
1
1
1
1
1
3
3
3
3
2
2
2
1
1
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
5
5
5
5
5
5
5
4
4
4
4
3
3
3
3
2
2
2
2
2
2
1
1
4
4
4
4
4
4
4
4
4
4
4
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
1
1
1
1
1
1
1
1
1
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

6

razstec 31 Junior Poster in Training

done it :)
issue_date = datetime.strptime(datef, "%Y-%m-%dT%H:%M:%S.%f%z")

but now :(

  if period_name == "All Weeks":
            labels = range(1, 53)
            data[week_number_of_year(issue_date) - 1] +=1
        else:
            labels =["Week {}".format(x) for x in range(1, 6)]

        data[week_number_of_month(issue_date) - 1] += 1




          File "/Users/ricardosimoes/PycharmProjects/OCPP/week_report.py", line 116, in get_chart
data[week_number_of_month(issue_date) - 1] += 1
IndexError: list index out of range
razstec 31 Junior Poster in Training
issue_date = datetime.strptime(datef, "%Y-%m-%dT%H:%M:%S.%f")



    raise ValueError("unconverted data remains: %s" %

ValueError: unconverted data remains: +0000

a little improvement but still, this is one crazy timeframe....

can this help?
https://stackoverflow.com/questions/41684991/datetime-strptime-2017-01-12t141206-000-0500-y-m-dthms-fz

razstec 31 Junior Poster in Training

http://5.9.10.113/61386591/python-jira-rest-api-iso-8601

import datetime
datetime.datetime.now().astimezone().replace(microsecond=0).isoformat()

>>> 2020-03-21T14:31:43+13:00

maybe this as a hint, need to check it better
https://github.com/hmrc/jira-metrics/blob/master/jira-metrics.py

razstec 31 Junior Poster in Training

date is send by jira in this format

datef=2021-07-16T13:13:01.000+0000

razstec 31 Junior Poster in Training

it seems there is a date not converted

    raise ValueError("unconverted data remains: %s" %

ValueError: unconverted data remains: T13:13:01.000+0000

i think is this issue_date

       for issue in jsearch:
        tipo = issue.fields.project.name.strip()
        datef = issue.fields.created.strip()
        issue_date = datetime.strptime(datef, '%Y-%m-%d')

    if period_name == "All Weeks":
razstec 31 Junior Poster in Training

thank you :)

now i get this odd error

def jsearch_by(projects, users, start_date, end_date, start, size):
    """ Submits a query to the JIRA server and returns the results."""
    source_query = 'project in {projects} AND creator in {users}'.format(projects=projects, users=users)
    date_query = 'AND created >= {start} AND created < {end}'.format(start=start_date.strftime("%Y-%m-01"),end=end_date.strftime("%Y-%m-%d"))
    query = "{}{}".format(source_query, date_query)
    return jira.search_issues(query, start, size). <------- error






      File "/Users/ricardosimoes/PycharmProjects/OCPP/week_report.py", line 139, in jsearch_by
        return search_issues(query, start, size)
    NameError: name 'jira' is not defined

change jira to JIRA and the error changed

 File "/Users/ricardosimoes/PycharmProjects/OCPP/week_report.py", line 139, in jsearch_by
    return JIRA.search_issues(query, start, size)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/jira/client.py", line 2501, in search_issues
    if self._fields:

AttributeError: 'str' object has no attribute '_fields'

Any idea??

razstec 31 Junior Poster in Training

wow, thanks

just having an issue with the start

File "/Users/ricardosimoes/PycharmProjects/OCPP/week_report.py", line 137, in jsearch_by
    date_query = 'AND created >= {start} AND created < {end}'.format(start_date.strftime("%Y-%m-01"), end_date.strftime("%Y-%m-%d"))

KeyError: 'start'

I had this to the if name == "main":

    dt = datetime.today()

    size = 9999
    initial = 0
    start = initial * size

but still get this error

razstec 31 Junior Poster in Training

ok, this is getting issues from jira just fine, although it dont stop :s the for loop just restart the all the issues a loaded and goes on like that.

I cant give the credentials for jira, im sorry, i just cant do that, althoug i understand and aprreciate your trying to help.

if theres any other way let me know

from tkinter import *
import calendar
import numpy as np
import matplotlib.pyplot as plt
from datetime import datetime, timedelta
from tkinter import Tk, Button, ttk
from jira import JIRA
import numpy as np
import matplotlib.pyplot as plt
import calendar
from datetime import datetime, date
#from jira import JIRA

root = Tk()
w, h = root.winfo_screenwidth(), root.winfo_screenheight()
root.geometry("%dx%d+0+0" % (w, h))
root.title("week")

dt = datetime.today()
cd = calendar.Calendar()

yearstartdate = dt.replace(month=1, day=1)
enddate = dt
if enddate.month == 1:
    startdate = enddate.replace(month=12, year=enddate.year-1)
else:
    startdate = enddate.replace(month=enddate.month-1)

year_totals = {"Total": 0}
month_totals = {"Total": 0}
last_month_totals = {"Total": 0}

serverURL = 'https://jira.mob.dev/'
user = 'user'
password = 'pass'

options = {'server': serverURL}
jira = JIRA(options, basic_auth=(user, password))

c = calendar.TextCalendar(calendar.SUNDAY)
#c.prmonth(2021, 7)
cd = calendar.Calendar()


todays_date = date.today()
ano = todays_date.year
mes = todays_date.month


size = 9999
initial = 0
cont = 0
lst_proj_gwf = []
lst_proj_op = []
lst_date = []

start= initial*size


projapesquisar = str("GPD, OP")
utlapesquisar1 = str("user1"), str("user2"), str(
    "user3")
utlapesquisar2 = str("user4"), str("user5"), str(
    "user6")# this dont let me have them together, i have to split it :/
utlapesquisar = str(utlapesquisar1 + utlapesquisar2)

jsearch_current_month = …
razstec 31 Junior Poster in Training

this is 1h in the morning, will test it tomorow.

the biggest issue is to pick a month and create the chart weekly based on that month, got it to get the weeks but cant seem to use it in order to do the query

razstec 31 Junior Poster in Training

been making some change, this is harder than i though.
the sample data is diferente ill try to upload a file for you

from tkinter import Tk, Button, ttk
from jira import JIRA
import numpy as np
import matplotlib.pyplot as plt
import calendar
from datetime import datetime, date

root = Tk()
w, h = root.winfo_screenwidth(), root.winfo_screenheight()
root.geometry("%dx%d+0+0" % (w, h))
root.title("week")


serverURL = 'https://jira.mob.dev/'
user = 'user'
password = 'pass'

options = {'server': serverURL}
jira = JIRA(options, basic_auth=(user, password))

c = calendar.TextCalendar(calendar.SUNDAY)
#c.prmonth(2021, 7)
cd = calendar.Calendar()


todays_date = date.today()
ano = todays_date.year
mes = todays_date.month


for i in cd.monthdayscalendar(2021, 7):
    print(i, end=" ")


print("\n\n-->"+str(len(cd.monthdayscalendar(2021, 7))))


size = 9999
initial = 0
cont = 0
lst_proj_gwf = []
lst_proj_op = []
lst_date = []

start= initial*size

projapesquisar = str("Operations, Project")
utlapesquisar1 = str("user1"), str("user2"), str("user3")
utlapesquisar2 = str("user4"), str("user5"), str("user6")
utlapesquisar = str(utlapesquisar1 + utlapesquisar2)

jsearch_current_month = jira.search_issues('project in ('+projapesquisar+') AND creator in ('+utlapesquisar+') AND created >= ' + str(ano) + '-' + str(mes) + '-01', start, size)

jsearch_last_month = jira.search_issues(
    'project in ('+projapesquisar+') AND creator in ('+utlapesquisar+') AND created >= ' + str(ano) + '-' + str(mes-1) + '-01 AND created < ' +str(ano) + '-'+ str(mes) + '-01', start, size)

jsearch_all_year = jira.search_issues(
    'project in ('+projapesquisar+') AND creator in ('+utlapesquisar+') AND created >= ' + str(ano) + '-01-01', start, size)

def get_chart(mess):
    initial = 0
    while True: 
        if len(mess) == 0:
            break
        initial += 1
        for issue in mess:
            print("Projecto:",issue.fields.project.name)#Operations or Project
            print("Created On:",issue.fields.created) #ex: 2021-6-22 00:00:00

            if …
razstec 31 Junior Poster in Training

this as change a little, im getting the info not from sample.txt but from jira

this is working fine :)

from jira import JIRA

serverURL = 'https://jira.mob.dev/'
user = 'user'
password = 'pass'

options = {'server': serverURL}
jira = JIRA(options, basic_auth=(user, password))

size = 9999
initial = 0
cont = 0
while True:
    start= initial*size
    issues = jira.search_issues('project in (REV, OP)AND created >= 2021-01-01',  start,size)

    if len(issues) == 0:
        break
    initial += 1
    for issue in issues:
        print("Projecto:",issue.fields.project)
        print("Created On:",issue.fields.created)
        cont +=1

I need to make barchart from here

for i in cd.monthdayscalendar(2021, dt.month): #current month
    make chart for each week
for i in cd.monthdayscalendar(2021, dt.month-1):#last month
    make chart for each week
# form the begining of the year
razstec 31 Junior Poster in Training

Type Date

Reviews 24/03/21
Operations 24/03/21
Operations 24/03/21
Operations 24/03/21
Reviews 24/03/21
Operations 24/03/21
Operations 24/03/21
Reviews 24/03/21
Reviews 25/03/21
Reviews 25/03/21
Reviews 25/03/21
Reviews 25/03/21
Operations 25/03/21
Operations 25/03/21
Reviews 26/03/21
Reviews 26/03/21
Reviews 26/03/21
Reviews 29/03/21
Operations 29/03/21
Reviews 29/03/21
Reviews 29/03/21
Reviews 29/03/21
Reviews 30/03/21
Operations 30/03/21
Operations 30/03/21
Operations 30/03/21
Operations 30/03/21
Reviews 31/03/21
Reviews 01/04/21
Reviews 01/04/21
Reviews 01/04/21
Reviews 01/04/21
Reviews 01/04/21
Reviews 01/04/21
Reviews 01/04/21
Operations 01/04/21
Operations 01/04/21
Reviews 04/04/21
Reviews 05/04/21
Reviews 05/04/21
Operations 05/04/21
Operations 05/04/21
Reviews 05/04/21
Reviews 05/04/21
Reviews 05/04/21
Reviews 05/04/21
Reviews 06/04/21
Operations 06/04/21
Operations 06/04/21
Operations 06/04/21
Operations 06/04/21
Reviews 06/04/21
Reviews 06/04/21
Operations 06/04/21
Operations 06/04/21
Reviews 07/04/21
Reviews 07/04/21
Reviews 07/04/21
Reviews 07/04/21
Reviews 07/04/21
Operations 07/04/21
Reviews 07/04/21
Reviews 07/04/21
Operations 08/04/21
Operations 08/04/21
Operations 08/04/21
Operations 08/04/21
Reviews 08/04/21
Operations 08/04/21
Operations 09/04/21
Operations 12/04/21
Operations 12/04/21
Operations 12/04/21
Operations 13/04/21
Operations 13/04/21
Operations 13/04/21
Operations 13/04/21
Operations 13/04/21
Operations 13/04/21
Operations 13/04/21
Operations 13/04/21
Operations 13/04/21
Operations 13/04/21
Operations 13/04/21
Operations 13/04/21
Operations 13/04/21
Operations 13/04/21
Operations 13/04/21
Operations 13/04/21
Operations 13/04/21
Operations 13/04/21
Operations 13/04/21
Operations 13/04/21
Reviews 13/04/21
Reviews 13/04/21
Operations 13/04/21
Operations 13/04/21
Operations 13/04/21
Operations 13/04/21
Operations 13/04/21
Operations 13/04/21
Reviews 13/04/21
Operations 13/04/21
Operations 13/04/21
Operations 13/04/21
Reviews 13/04/21
Operations 14/04/21
Operations 14/04/21
Operations 14/04/21
Operations 14/04/21
Operations 14/04/21
Operations 14/04/21
Operations 14/04/21
Operations 14/04/21
Operations 14/04/21
Operations 14/04/21
Operations 14/04/21
Operations 14/04/21
Operations 15/04/21
Operations 15/04/21
Reviews 15/04/21
Reviews 15/04/21
Reviews 15/04/21
Operations 15/04/21

razstec 31 Junior Poster in Training
from tkinter import *
import calendar
import datetime
import numpy as np
import matplotlib.pyplot as plt

from datetime import datetime

datetime_object = datetime.strptime('Jun 1 2005  1:33PM', '%b %d %Y %I:%M%p')

root = Tk()
w, h = root.winfo_screenwidth(), root.winfo_screenheight()
root.geometry("%dx%d+0+0" % (w, h))
root.title("week")

dt = datetime.datetime.today()
cd = calendar.Calendar()


file = open("sample.txt")
data = file.read()

lst_last_month=[]
for tipo, data in data:
    datetime_object = datetime.strptime(data, '%b %d %Y %I:%M%p')
    if startdate <= datetime_object <= enddate:
        lst_last_month.append(data)
        lst_last_month.append(tipo)






lst_dat = []
for name in calendar.month_name:
    lst_dat.append(name)


Label(root, text=lst_dat[dt.month-1], justify=RIGHT, anchor="e").grid(row=0, column=0, sticky=W, pady=1)
x=1
for l in cd.monthdayscalendar(2021, dt.month-1):
    Label(root, text=str("Week"+str(x)), justify=RIGHT, anchor="e").grid(row=x, column=0, sticky=W, pady=1)
    Label(root, text=l, justify=RIGHT, anchor="e").grid(row=x, column=1, sticky=W, pady=1)
    x += 1



Label(root, text=lst_dat[dt.month], justify=RIGHT, anchor="e").grid(row=0, column=4, sticky=W, pady=1)
x=1
for i in cd.monthdayscalendar(2021, dt.month):
    Label(root, text=str("Week"+str(x)), justify=RIGHT, anchor="e").grid(row=x, column=3, sticky=W, pady=1)
    Label(root,text=i, justify=RIGHT, anchor="e").grid(row=x, column=4,sticky=W, pady=1)
    x += 1



Label(root, text=data, justify=RIGHT, anchor="e").grid(row=0, column=10, rowspan="9999",sticky=W, pady=1)
print(data)
file.close()


class Table:

    def __init__(self, root):
        Label(root, text=lst_dat[dt.month-1], justify=RIGHT,width=20, fg='blue',font=('Arial', 26, 'bold') ,anchor="e").grid(row=8, column=0, sticky=W, pady=1)
        for i in range(total_rows):
            for j in range(total_columns):
                self.e = Entry(root, width=20, fg='blue',
                               font=('Arial', 16, 'bold'))

                self.e.grid(row=i+9, column=j)
                self.e.insert(END, lst[i][j])


        Label(root, text=lst_dat[dt.month], justify=RIGHT, width=20, fg='blue', font=('Arial', 26, 'bold'), anchor="e").grid(
            row=18, column=0, sticky=W, pady=1)
        for i in range(total_rows):
            for j in range(total_columns):
                self.e = Entry(root, width=20, fg='blue',
       ("Week2", '54', '55'),
       ("Week3", '22', '24'),
       ("Week4", '11', '12'),
       ("Week5", '37', '53')]


total_rows = len(lst)
total_columns = len(lst[0])

# create root window
t = Table(root)



if __name__ == "__main__":
    root.mainloop()
razstec 31 Junior Poster in Training

Need to make independent charts for current month, last month and since the beginnig of the year.

Been trying to make the table and then make the bar charts, got so far but cant seem to populate my code in order to build the tables with the specific data from a txt.

been playing arround but cant seem to do this, can someone help?

from tkinter import *
import calendar
import datetime
import numpy as np
import matplotlib.pyplot as plt

from datetime import datetime

datetime_object = datetime.strptime('Jun 1 2005  1:33PM', '%b %d %Y %I:%M%p')

root = Tk()
w, h = root.winfo_screenwidth(), root.winfo_screenheight()
root.geometry("%dx%d+0+0" % (w, h))
root.title("week")

dt = datetime.datetime.today()
cd = calendar.Calendar()


file = open("sample.txt")
data = file.read()

lst_last_month=[]
for tipo, data in data:
    datetime_object = datetime.strptime(data, '%b %d %Y %I:%M%p')
    if startdate <= datetime_object <= enddate:
        lst_last_month.append(data)
        lst_last_month.append(tipo)

This is the expected end result

este.png

razstec 31 Junior Poster in Training

https://github.com/razsim/pythonProject, can you access like this or do i have to give you some permissions?

razstec 31 Junior Poster in Training

it creates the tabs based on the txt

tabControl = ttk.Notebook(tabmain1)



    style = ttk.Style()
    style.theme_create("stl_obrigator", parent="alt", settings={
        "TNotebook": {"configure": {"tabmargins": [2, 5, 2, 0]}},
        "TNotebook.Tab": {
            "configure": {"padding": [5, 1], "background": "#fd6262"},
            "map": {"background": [("selected", "#fd2b2b")],
                    "expand": [("selected", [1, 1, 1, 0])]}}})

    style.theme_create("stl_facult", parent="alt", settings={
        "TNotebook": {"configure": {"tabmargins": [2, 5, 2, 0]}},
        "TNotebook.Tab": {
            "configure": {"background": "#62fd72"},
            "map": {"background": [("selected", "#02d417")],
                    "expand": [("selected", [1, 1, 1, 0])]}}})

    style.theme_use("stl_obrigator")
    tab0 = ttk.Frame(tabControl)
    tabControl.add(tab0, text="Messages")

    lst_menu= []
    lst_tipo=[]
    for line in varconfbook:
        if len(line) > 1:
            aaaaaa, tipo,nome,bbbbb,ccccc,ddddddd = line.split('<->')
            if nome not in lst_menu:
                lst_menu.append(nome)
                lst_tipo.append(tipo)


    x = 0
    for nome,tipo in zip(lst_menu, lst_tipo):
        if "Obrigatorio" in tipo:
            style.theme_use("stl_obrigator")
        else:
            style.theme_use("stl_facult")

        if x == 1:
            tab1 = ttk.Frame(tabControl)
            tabControl.add(tab1, text=nome.strip())
            tabControl.pack(expand=1, fill="both")
            makesubmenu(nome.strip(), tab1)

        elif x == 2:
            tab2 = ttk.Frame(tabControl)
            tabControl.add(tab2, text=nome.strip())
            tabControl.pack(expand=1, fill="both")
            makesubmenu(nome.strip(), tab2)

        elif x == 3:
            tab3 = ttk.Frame(tabControl)
            tabControl.add(tab3, text=nome.strip())
            tabControl.pack(expand=1, fill="both")
            makesubmenu(nome.strip(), tab3)

        elif x == 4:
            tab4 = ttk.Frame(tabControl)
            tabControl.add(tab4, text=nome.strip())
            tabControl.pack(expand=1, fill="both")
            makesubmenu(nome.strip(), tab4)

        elif x == 5:
            tab5 = ttk.Frame(tabControl)
            tabControl.add(tab5, text=nome.strip())
            tabControl.pack(expand=1, fill="both")
            makesubmenu(nome.strip(), tab5)

        elif x == 6:
            tab6 = ttk.Frame(tabControl)
            tabControl.add(tab6, text=nome.strip())
            tabControl.pack(expand=1, fill="both")
            makesubmenu(nome.strip(), tab6)

        if x == 7:
            tab7 = ttk.Frame(tabControl)
            tabControl.add(tab7, text=nome.strip())
            tabControl.pack(expand=1, fill="both")
            makesubmenu(nome.strip(), tab7)

        elif x == 8:
            tab8 = ttk.Frame(tabControl)
            tabControl.add(tab8, text=nome.strip())
            tabControl.pack(expand=1, fill="both")
            makesubmenu(nome.strip(), tab8)

        elif x == 9:
            tab9 = ttk.Frame(tabControl)
            tabControl.add(tab9, text=nome.strip())
            tabControl.pack(expand=1, fill="both")
            makesubmenu(nome.strip(), tab9)

        elif x == 10:
            tab10 = ttk.Frame(tabControl)
            tabControl.add(tab10, text=nome.strip())
            tabControl.pack(expand=1, fill="both")
            makesubmenu(nome.strip(), tab10)

        elif x == 11:
            tab11 = ttk.Frame(tabControl)
            tabControl.add(tab11, text=nome.strip())
            tabControl.pack(expand=1, …
razstec 31 Junior Poster in Training

hope this could work

    style = ttk.Style()
    style.theme_create("stl_obrigator", parent="alt", settings={
        "TNotebook": {"configure": {"tabmargins": [2, 5, 2, 0]}},
        "TNotebook.Tab": {
            "configure": {"padding": [5, 1], "background": "#fd6262"},
            "map": {"background": [("selected", "#fd2b2b")],
                    "expand": [("selected", [1, 1, 1, 0])]}}})

    style.theme_create("stl_facult", parent="alt", settings={
        "TNotebook": {"configure": {"tabmargins": [2, 5, 2, 0]}},
        "TNotebook.Tab": {
            "configure": {"padding": [5, 1], "background": "#62fd72"},
            "map": {"background": [("selected", "#02d417")],
                    "expand": [("selected", [1, 1, 1, 0])]}}})

    style.theme_use("stl_obrigator")
    tab0 = ttk.Frame(tabControl)
    tabControl.add(tab0, text="Messages")

    lst_menu= []
    lst_tipo=[]
    for line in varconfbook:
        if len(line) > 1:
            aaaaaa, tipo,nome,bbbbb,ccccc,ddddddd = line.split('<->')
            if nome not in lst_menu:
                lst_menu.append(nome)
                lst_tipo.append(tipo)


    x = 0
    for nome,tipo in zip(lst_menu, lst_tipo):
        if "Obrigatorio" in tipo:
            style.theme_use("stl_obrigator")
        else:
            style.theme_use("stl_facult")
razstec 31 Junior Poster in Training

this is way outer my league... too complicated for now, thank you so much for all the time you spend. ill come back to this when im a little more advance in python.

ill keep it like this

but maybe you can help me this, im sure its easier.... i whant to change the background color of the tab that have obrigatorio in tipo.

 x = 0
    for nome,tipo in zip(lst_menu, lst_tipo):
        if "Obrigatorio" in tipo:
            bgcol = "red"
        else:
            bgcol = "green"

        if x == 1:
            tab1 = ttk.Frame(tabControl)
            tabControl.add(tab1, text=nome.strip())
            tabControl.pack(expand=1, fill="both")
            makesubmenu(nome.strip(), tab1)

        elif x == 2:
            tab2 = ttk.Frame(tabControl)
            tabControl.add(tab2, text=nome.strip())
            tabControl.pack(expand=1, fill="both")
            makesubmenu(nome.strip(), tab2)

        elif x == 3:
            tab3 = ttk.Frame(tabControl)
            tabControl.add(tab3, text=nome.strip())
            tabControl.pack(expand=1, fill="both")
            makesubmenu(nome.strip(), tab3)

        elif x == 4:
            tab4 = ttk.Frame(tabControl)
            tabControl.add(tab4, text=nome.strip())
            tabControl.pack(expand=1, fill="both")
            makesubmenu(nome.strip(), tab4)

        elif x == 5:
            tab5 = ttk.Frame(tabControl)
            tabControl.add(tab5, text=nome.strip())
            tabControl.pack(expand=1, fill="both")
            makesubmenu(nome.strip(), tab5)

        elif x == 6:
            tab6 = ttk.Frame(tabControl)
            tabControl.add(tab6, text=nome.strip())
            tabControl.pack(expand=1, fill="both")
            makesubmenu(nome.strip(), tab6)

        if x == 7:
            tab7 = ttk.Frame(tabControl)
            tabControl.add(tab7, text=nome.strip())
            tabControl.pack(expand=1, fill="both")
            makesubmenu(nome.strip(), tab7)

        elif x == 8:
            tab8 = ttk.Frame(tabControl)
            tabControl.add(tab8, text=nome.strip())
            tabControl.pack(expand=1, fill="both")
            makesubmenu(nome.strip(), tab8)

        elif x == 9:
            tab9 = ttk.Frame(tabControl)
            tabControl.add(tab9, text=nome.strip())
            tabControl.pack(expand=1, fill="both")
            makesubmenu(nome.strip(), tab9)

        elif x == 10:
            tab10 = ttk.Frame(tabControl)
            tabControl.add(tab10, text=nome.strip())
            tabControl.pack(expand=1, fill="both")
            makesubmenu(nome.strip(), tab10)

        elif x == 11:
            tab11 = ttk.Frame(tabControl)
            tabControl.add(tab11, text=nome.strip())
            tabControl.pack(expand=1, fill="both")
            makesubmenu(nome.strip(), tab11)

        elif x == 12:
            tab12 = ttk.Frame(tabControl)
            tabControl.add(tab12, text=nome.strip())
            tabControl.pack(expand=1, fill="both")
            makesubmenu(nome.strip(), tab12)

        elif x == 13:
            tab13 = ttk.Frame(tabControl)
            tabControl.add(tab13, text=nome.strip())
            tabControl.pack(expand=1, …
razstec 31 Junior Poster in Training

made some changes but its still 5 slots

ChangeConfiguration<->Configuration <-> Change ID <-> {"key": "Identity","value": "00006"}<->Reboot Response
ClearCache<->ClearCache <-> Without Inputs <-> {}<-> Response retrieving all conf
ChangeAvailability<-> Availability <-> Without Inputs <-> {}<->CALLERROR Response

razstec 31 Junior Poster in Training

got the same error as before

 File "/Users/ricardosimoes/PycharmProjects/pythonProject/OCP/testes/tabset.py", line 69, in packTabs
    tab_count, tab_title, button_name, json_request, expected_response = line.split('<->')
ValueError: not enough values to unpack (expected 5, got 1)
razstec 31 Junior Poster in Training

Made a small change since there is no need for the tabs.txt since that info is in json_dumps.txt

import os
import time
from tkinter import *
import tkinter as tk
from tkinter import ttk, PhotoImage, LabelFrame, Text, GROOVE, Button, Label, scrolledtext
from tkinter.scrolledtext import ScrolledText
import requests
import json


def runpost(resp_json,reqtxt,tiporeq):
    try:
        getconfval = reqtxt.get(1.0, "end-1c")
        if len(getconfval)>1:
            resp_json.delete('1.0', END)
            resp_json.insert(tk.INSERT, str(url_endpoint+tiporeq)+", headers="+str(headers)+", data=json.dumps("+str(getconfval)+"), timeout="+str(timeoutvar)+"\n\n\n")
            reqjson = requests.request("POST", str(url_endpoint+tiporeq), headers=headers, data=json.dumps(getconfval), timeout=int(timeoutvar))
            statReason = ("Request:\n\n" + getconfval + "\n\nStatus:\n\n" + str(reqjson.status_code) + " - " + str(reqjson.reason) + "\n\nResponse:\n\n" + str(reqjson.text))
            resp_json.insert(tk.INSERT, statReason)

    except Exception as e:
        from OCPP.main import log_error
        resp_json.insert(tk.INSERT, "\n\n"+str(e)+"\n\n")
        log_error(e, "runpost")


    def ChangConfWI(tipreq,reqtxt,lblexp):
    #try:
        reqtxt.delete('1.0', END)
        lblexp.delete('1.0', END)
        reqtxt.insert(tk.INSERT, lstjsonreq[tipreq])
        lblexp.insert(tk.INSERT, str(lstexpectresq[tipreq]))
    #except Exception as e:
     #   from OCPP.main import log_error
      #  log_error(e, "ChangConfWI")


def generateTabs(tabControl, tabMenus):
    tab = list()
    for i, key in enumerate(tabMenus.keys()):
        tab.append(ttk.Frame(tabControl))
        tabControl.add(tab[i], text=key)
        ttk.Label(tab[i], text=tabMenus[key])
    tabControl.pack(expand=1, fill="both")
    return tab


###########################################nova janela####################################

def gera_forms(parent, get_inp_cond_id, get_inp_cond_endpoint):
    parent.pack_forget()

    nome_endpoint, timeoutvar, url_endpoint = get_inp_cond_endpoint.split('<:>')
    nome_endpoint = nome_endpoint.replace('  ', '').strip()
    url_endpoint = url_endpoint.replace(' ', '').strip()
    timeoutvar = timeoutvar.replace(' ', '').strip()

    photoRun = PhotoImage(file=r'img/run.png')
    photoOK = PhotoImage(file=r'img/ok.png')
    photoNot = PhotoImage(file=r'img/notok.png')

    headers = {'Content-Type': 'application/json', 'chargingstation':'stat1'}

    tiporeq = ""
    payload = json.dumps({})
    expResp = ""

    varconfbook = open("Confs/json_dumps.txt", "r").readlines()
    lsttiporeq = []
    lsttitreq = []
    lstjsonreq = []
    lstexpectresq = []

    tab = []

    def makesubmenu(tipo_de_conf, framename):

        frm_json_case_button = ttk.Frame(framename)
        frm_json_case_button.grid(column=0, row=0, rowspan=99)

        frm_txt_json_case = ttk.Frame(framename)
        frm_txt_json_case.grid(column=1, row=0)

        url_show=ttk.Label(frm_txt_json_case, text=nome_endpoint + "  @  " + str(url_endpoint + tipo_de_conf) + "  @  " + get_inp_cond_id)
        url_show.grid(column=1, row=0, columnspan=99, …
razstec 31 Junior Poster in Training

the submenu have options of json request, the the request is show in Request and expected response in expected response, when you run the post it will output to response of the json request and then theres is a box for comments.

the messages tab is a diferent thing, you can ignore it