I have read about this: Pretty table of contents
Can someone tell me how to do that circle for my \part? I tried to copy some code but obviously did not work.
\documentclass[twoside]{book}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\usepackage{geometry}
\usepackage{fancyhdr,calc,blindtext}
\usepackage{xwatermark,wallpaper,grffile}
\usepackage{bm,graphicx,empheq,etoolbox}
\usepackage{units,cancel,mathtools,lipsum,lmodern}
\usepackage{varwidth,verbatim,setspace,lmodern}
\usepackage{anyfontsize,rotating,framed,titletoc}
\usepackage{amsmath,tocloft, amssymb,fancyhdr,color,contour}
\usepackage{booktabs,caption,multirow,marginnote}
\usepackage{xcolor}
\usepackage[explicit]{titlesec}
\usepackage[listings]{tcolorbox}
\tcbuselibrary{listings,theorems,skins,breakable
,theorems,many,raster}
\usepackage{hyperref}
\hypersetup{colorlinks=true, linkcolor=black, anchorcolor=black, citecolor=black, urlcolor=black,pdfstartpage=5}
\usepackage{listings, float, wasysym}
\floatstyle{boxed}
\setlength\parindent{0pt}
\DeclareMathAlphabet{\mathpzc}{OT1}{pzc}{m}{it}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{fadings,decorations.text}
\setcounter{tocdepth}{3}
\addtocontents{toc}{\cftpagenumbersoff{chapter}}
\setlength{\cftsubsecindent}{\cftsecnumwidth}
\patchcmd{\tableofcontents}{\contentsname}{\sffamily\contentsname}{}{}
\setlength{\cftbeforechapskip}{6ex}
\setlength{\cftbeforesecskip}{0ex}
%---this doesn't work!--------------
\newcommand\mycircle[1]{
\begin{tikzpicture}%
\node[draw=yellow,circle, text width=18pt,line width=1pt,align=center] {#1};
\end{tikzpicture}}
\makeatletter
\patchcmd{\@part}
{\addcontentsline{toc}{part}{\thepart\hspace{1em}#1}}
{\addtocontents{toc}{\protect\addvspace{20pt}}
\addcontentsline{toc}{part}{\huge{\protect\color{yellow}%
\setlength\fboxrule{2pt}\protect\mycircle{%
\hfil\thepart\hfil%
}%
}\\[2ex]\color{red}\sffamily#1}}{}{}
%----------------------------
\begin{document}
\tableofcontents
\part{First Part}
\chapter{My first}
\section{section 1}
\subsection{stuff1}
\subsubsection{substuff1}
\subsection{stuff2}
\subsection{stuff3}
\chapter{My second}
\section{section 2}
-----------
\part{Second Part}
\chapter{My third}
\section{section 3}
\end{document}
